使用LINQ在集合中未实现该方法或操作

时间:2013-06-20 12:21:58

标签: .net vb.net linq collections

当我尝试循环到一个集合时,我得到了异常。

//代码

fieldFormatDropDown.DataSource = From FieldFormatLinq In fieldFormatsCollection Where FieldFormatLinq.DataTypeId = dataTypeId And FieldFormatLinq.IsActive = True

//例外:

The method or operation is not implemented

为什么我得到这个?

1 个答案:

答案 0 :(得分:1)

尝试转换为Tolist()

//代码

fieldFormatDropDown.DataSource = (From FieldFormatLinq In fieldFormatsCollection Where FieldFormatLinq.DataTypeId = dataTypeId And FieldFormatLinq.IsActive = True).ToList()