Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, May 11, 2012 8:38 AM | 1 vote
Hi all ,
I need to split following type of string to key value pair
"key1=val1,key2=val2,keyN=valN" is it possible
Thanks in advance
All replies (1)
Friday, May 11, 2012 8:41 AM âś…Answered | 3 votes
hi Web developer ,
Please try this one
string s = "key1=val1,key2=val2,keyN=valN";
var dict = s.Split(',')
.Select(x => x.Split('='))
.ToDictionary(x => x[0], x => x[1]);
Happy Coding Syam.S