How to convert a 2-d array into a dictionary object

Posted by Nikron on Stack Overflow See other posts from Stack Overflow or by Nikron
Published on 2010-05-12T09:13:29Z Indexed on 2010/05/12 9:24 UTC
Read the original article Hit count: 172

Filed under:
|

Hi,

I have an array of type string that looks like this: "test1|True,test2|False,test3|False,test4|True". This is essentially a 2d array like so [test1][True] [test2][False] [test3][False] [test4][True].

I want to convert this into a dictionary<string,bool> using linq, something like:

Dictionary<string, bool> myResults = results.Split(",".ToCharArray).ToDictionary()

any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ