How to convert Dictionary to Dictionary in c#

前端 未结 6 638
日久生厌
日久生厌 2020-12-08 09:23

I have below code in C#

Dictionary dObject = new Dictionary();

I want to convert dObject<

6条回答
  •  悲&欢浪女
    2020-12-08 09:50

    Since you are using .net 2.0:

    Dictionary dString = new Dictionary();
    
    foreach (KeyValuePair item in dObject)
    {
        dString.Add(item.Key, item.Value.ToString());
        //here item.Value.ToString() is an example
        //you should convert your item to string according to the requirement
    }
    

提交回复
热议问题