Hi i started to work with linq and i have some trouble to split an string:
This is the string:
a;b;cod1;xx|a;b;cod2;xx|a;b;cod3;xx|a;b;cod4;xx
first i split the sring by the ‘|’ character so i got this result
a;b;cod1;xx
a;b;cod2;xx
a;b;cod3;xx
a;b;cod4;xx
and then i split again by the ‘;’ in the second index to have this result in to a list
cod1
cod2
cod3
cod4
so there is a better way to do this using linq ¿?
Thanks!
You can use
Selectto put your code into one line (but you still have to useString.Split):so you don’t have to use
for/foreachloops.