C
CSharper
Yesterday I was working on a code where I need to split the parameters
and create dictionary from it. The string is something like the
following
name key1=value1 key2=value2
here is the code
string[][] pharsed = argument.Skip(1).Select(s =>
s.split(’=')).ToArray();
IDictionary<string, string> dictionary = new Dictionary<string,
string>();
foreach(string[] vaue in pharsed)
{
dictionary.add(vaue[0], vaue[1]);
}
Just want to know, is it possible to create the dictionary also in the
same line of code instead of doing it like I am trying?
http://myfavoritemovies.us/csharp/?p=21
and create dictionary from it. The string is something like the
following
name key1=value1 key2=value2
here is the code
string[][] pharsed = argument.Skip(1).Select(s =>
s.split(’=')).ToArray();
IDictionary<string, string> dictionary = new Dictionary<string,
string>();
foreach(string[] vaue in pharsed)
{
dictionary.add(vaue[0], vaue[1]);
}
Just want to know, is it possible to create the dictionary also in the
same line of code instead of doing it like I am trying?
http://myfavoritemovies.us/csharp/?p=21