Convert dictionary to list collection in C#

前端 未结 6 1365
余生分开走
余生分开走 2021-01-30 09:54

I have a problem when trying to convert a dictionary to list.

Example if I have a dictionary with template string as key and string as value. Then I wish to convert the

6条回答
  •  佛祖请我去吃肉
    2021-01-30 10:38

    If you want convert Keys:

    List listNumber = dicNumber.Keys.ToList();
    

    else if you want convert Values:

    List listNumber = dicNumber.Values.ToList();
    

提交回复
热议问题