【发布时间】:2012-03-23 14:03:15
【问题描述】:
好的,所以我在 C# 中有两个列表
List<Attribute> attributes = new List<Attribute>();
List<string> songs = new List<string>();
一个是字符串,一个是我创建的属性对象..非常简单
class Attribute
{
public string size { get; set; }
public string link { get; set; }
public string name { get; set; }
public Attribute(){}
public Attribute(string s, string l, string n)
{
size = s;
link = l;
name = n;
}
}
我现在必须比较看看哪些歌曲不在属性名称中,例如
songs.Add("something");
songs.Add("another");
songs.Add("yet another");
Attribute a = new Attribute("500", "http://google.com", "something" );
attributes.Add(a);
我想要一种返回“另一个”和“又一个”的方法,因为它们不在属性列表名称中
所以对于伪代码
difference = songs - attributes.names
【问题讨论】:
标签: c# linq list linq-to-objects