You say:
now line.Split(','); won't work
At first this does not make any sense, because you have not shown us any code using line.Split()
, nor is there, under normal circumstances, any need to use line.Split()
when dealing with CSV files.
So, what this is telling us is that instead of using a CSV library to read your CSV file, you are trying to parse the file yourself, with custom, hand-written code. And of course you are doing this in the most naive way possible, that is, with line.Split()
.
Don't do that.
Do yourself a favor and get the 'CSVHelper' library from NuGet and let it do your CSV parsing for you. That's the "normal circumstances" that I was talking about, and that's why normally line.Split()
is not needed.
Then, once you have read your array field into a string, you can go ahead and use field.Split()
on it.
The CSVHelper library is a bit of an overkill, as it does a lot more than what you actually need. For example, it can read lines from a CSV file directly into the members of a class representing a row of your CSV file. But it is okay: for several decades now, the entire software industry has been in the habit of using existing libraries for any trivial task at hand, even if only a tiny subset is needed from the entire wealth of functionality offered by the library.