What is the easiest way to parse a comma delimited string list of values into some kind of object that I can loop through, so that I can access the individual values easily?
example string: "0, 10, 20, 30, 100, 200"
I’m a bit new to C#, so forgive me for asking a simple question like this. Thanks.
there are gotchas with this – but ultimately the simplest way will be to use
If the number of commas and entries isn’t important, and you want to get rid of ’empty’ values then you can use
One thing, though – this will keep any whitespace before and after your strings. You could use a bit of Linq magic to solve that:
That’s if you’re using .Net 3.5 and you have the using System.Linq declaration at the top of your source file.