检查列表中是否存在一个条目的最快方法(明智的编码)是什么?MyObject 有 2 个属性
public class Name
{
public string FirstName{ get; set; }
public string LastName { get; set; }
}
然后我有另一个像这样的课程:
public class Foo
{
private List<Name> Names : new List<Name>();
public List<Name> Names { get; set; }
public bool Contains(Name x)
{
if (x == null)
return false;
>>> Navigate || Equals || Linq.Contains
>>> What's the easiest way to do this?
}
}