Im trying to search a file and see if any line contains the word Description1 AND if somewhere on that particular line two quotation marks appears directly after each other.
I have found various ways to delete or replace them but I want to keep them.
foreach (var line in File.ReadLines(FileName))
{
if (line.Contains ("Description1") )
{
MessageBox.Show ("Description1 found");
if (line.Contains (@"""") )
{
MessageBox.Show ("ERROR! Empty Description1 found.");
}
}
}
The file searched looks similar to this
propertyDescriptor="22004" PropertyName="Description1" PropertyType="Part" PropertyValue="Cat" propertyDescriptor="22004" PropertyName="Description1" PropertyType="Part" PropertyValue="" propertyDescriptor="22006" PropertyName="Description2" PropertyType="Part" PropertyValue=""
The errorcheck schould only detect the error on the second row where both Description1 and the two quoation marks exist.
My problem is that I get an error on every instance of the text Description1.
Any good ideas?
Thanks in advance.