There is! For some reason, it is buried in the VB namespace, but it is part of the .NET Framework, you just need to add a reference to the Microsoft.VisualBasic assembly. The type you are looking for is TextFieldParser .
Here is an example of checking your file:
using Microsoft.VisualBasic.FileIO; ... var path = @"C:\YourFile.csv"; using (var parser = new TextFieldParser(path)) { parser.TextFieldType = FieldType.Delimited; parser.SetDelimiters(","); string[] line; while (!parser.EndOfData) { try { line = parser.ReadFields(); } catch (MalformedLineException ex) {
Justin R.
source share