为ConcurrentDictionary.Select()声明变量

时间:2014-06-24 16:30:08

标签: c# linq dictionary

我有一个简单的ConcurrentDictionary,我正在尝试选择值的子集。

我正在使用此代码,我可以使用它的唯一方法是var来声明testStudents。这段代码的正确声明是什么?我尝试了List和IEnumratable,但它们没有用。

            public ConcurrentDictionary<string, Student> _Student = new ConcurrentDictionary<string, Student>();

            var testStudents = this._Student.Values.Select( s => s.Name = "jack");

1 个答案:

答案 0 :(得分:0)

谢谢大家。看起来我使用的是错误的方法。我需要使用Where方法。

IEnumerable<Student> testStudents
     = this._Student.Values.Where( s => s.Name = "jack");