【发布时间】:2012-01-17 10:54:01
【问题描述】:
我必须完成一个项目,但我有一个简单的问题
我有一个这样定义的类
using System;
using System.Collections;
using System.Collections.Generic;
..
public class GroupId: XmlDataTransferObject, IEnumerable
{
private IList _groupId;
private string _nameId;
public GroupId() : this("GroupId", "Id")
{
}
public GroupId(string rootName, string nomeId) : base(rootName)
{
_groupId = new ArrayList();
_nomeId = nomeId;
}
public override bool IsNull
{
get { return _groupId.Count == 0; }
}
public int Count
{
get { return _groupId.Count; }
}
public int Add(Intero i)
{
return _groupId.Add(i);
}
public Intero this[int index]
{
get { return (Intero)_groupId[index]; }
set { _groupId[index] = value; }
}
...
public IEnumerator GetEnumerator()
{
return _groupId.GetEnumerator();
}
}
}
我需要找到两个 GroupId 对象的实例之间的交集。
即使我声明了语句,为什么我在可用方法中看不到 Linq Intersect:
Using System.Linq
...
var x = _groupId1.Intersect(_groupId2);
...
错误 1 '....GroupId' 不包含 'Intersect' 的定义,并且找不到接受类型为 '...GroupId' 的第一个参数的扩展方法 'Intersect'(您是否缺少 using 指令还是程序集参考?)
【问题讨论】:
-
我假设
Using System.Linq是using System.Linq;的拼写错误(小写using和末尾的分号)
标签: c# linq extension-methods intersect