I have a string of the format \"key1=value1;key2=value2;key3=value3;\"
I need to convert it to a dictionary for the above mentioned key value pairs.
What wou
Updated Ani's to take in account the semi colon at the end. The where clause will ensure that you have a key and value before creating and entry.
var dictionary = "key1=value1;key2=value2;key3=value3;"
.Split(';')
.Select (part => part.Split('='))
.Where (part => part.Length == 2)
.ToDictionary (sp => sp[0], sp => sp[1]);