'Convert' Dictionary into List<object>

前端 未结 9 1901
感情败类
感情败类 2021-02-20 16:12

I have a Dictionary dictionary1 and I need to convert it into a List where Data has the properties lab

9条回答
  •  醉梦人生
    2021-02-20 16:30

    Just in case just helps anyone, I did it like this - will handle objects more complex than a single value type, as stated by the OP.

    // Assumes: Dictionary MyDictionary;
    List list = new List();
    list.AddRange(MyDictionary.Values.ToArray());
    

提交回复
热议问题