I wonder if I can transform this:
"abc , 123; xyz, 100; go, 9; move, 50;"
into this:
{ { "abc", "123" } , { "xyz" , "100" } , { "go" , "9" } , { "move" , "50" } }
(array of string[2]) with one long concatenated LINQ statement ?
Edit:
a from-in-where-select statements series is preferred
Edit 2:
also, is there also a way to transform the input string into some composite type like array of struct { string, int } or some Tuple<string,int> ?
like:
{
new Tuple<string, int>() { "abc", 123 } ,
new Tuple<string, int>() { "xyz" , 100 } ,
new Tuple<string, int>() { "go" , 9 } ,
new Tuple<string, int>() { "move" , 50 }
}
?
With
String.SplitabdString.Trimand LINQselect.UPDATE
To have an array of
KeyValuePair<string, int>To have an
Dictionary<string, int>