Convert a delimted string to a dictionary in C#

后端 未结 5 621
[愿得一人]
[愿得一人] 2020-12-24 11:30

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

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 11:54

    You could do this using JSON string, for example:

    var dic = JsonConvert.DeserializeObject>("{'1':'One','2':'Two','3':'Three'}");
    

提交回复
热议问题