To read a CSV from a string in C#, you can use the TextFieldParser class from the Microsoft.VisualBasic.FileIO namespace.
Here's an example code snippet that shows how to read a CSV from a string and convert it to a List<string[]> where each string array represents a row in the CSV:
main.cs798 chars32 lines
You can call this method by passing in your CSV string:
main.cs125 chars3 lines
This will give you a List<string[]> containing three string arrays, each representing a row in the CSV. You can loop through the list and access each column value by index:
main.cs160 chars9 lines
gistlibby LogSnag