Convert dictionary values to list using linq

后端 未结 2 1320
北恋
北恋 2020-12-30 19:56

Following code giving me \'Evaluation of lambda expressions is not valid in the debugger\'. Please suggest where I am doing wrong from below -

List

        
2条回答
  •  滥情空心
    2020-12-30 20:28

    You will get a compiler error simply trying to convert a dictionary's values to a list with ToList():

            Dictionary dict = new Dictionary();
            var result = dict.Values.ToList();
    

    Unless you include "using System.Linq" in your file.

提交回复
热议问题