I'm trying to parse a file that contains fields that seem valid to me but fail using C# TextFieldParser. Here is an example of problematic line:
"abc","def","this is container "A" in room","another field"
using TextFieldParser parser = new(Filename);
parser.TextFieldType = FieldType.Delimited;
parser.SetDelimiters(RawFileDelimiter);
parser.HasFieldsEnclosedInQuotes = true;
while (!parser.EndOfData)
{
string[] fields = parser.ReadFields();
// do some validation
}
I did not find any parameter in TextFieldParser to go through this case. I guess I could use regex to parse it but that will make the whole thing much more complicated. Am I missing something obvious?