I have a bunch of data in pipe-delimited format, where odd entries are index numbers, and even entries are the data e.g.
1|cat|2|dog|3|manatee|4||5|gerbil|6|etc
(note occasional missing values)
and I'm wondering if there is a nice .NET type way of turning this into a class pet with id and name parameters.
I've got some code which does a String.Split and iterates over the array, scraping together objects, but it looks more like I'm writing PL/SQL than C#... I'm sure there is a way of doing this in a single line of Linq or something - can anyone tell me the 'right' way to do this?
Thanks