I want to separate each item in a list, but within each item, divide the item if it contains the Is:
e.g.
string [] name = {"Peter: John: Connor", "Paul", "Mary: Blyth"}; Name.Dump (); will show:
Peter: John: Connor Paul Marie: Blythe However, any LINQ is I I can use it, which will provide the following list:
Peter John Connor Paul Mary Bliley I can use it: foreach (different person in name) {x = person.split (":"). ToList (); Foreach (var personinlist in x) {// personinlist}}
... but it seems winded too long, when I am some LINQ may be more elegant : < / Div>
To redress the consequences of dividing each code, :
names.SelectMany (n = & gt; n.Split (':')). Dump ();
No comments:
Post a Comment