2 つの属性の組み合わせが文字列に等しい LINQ を使用して、リストのすべての参照を削除しようとしています。
例:私はオブジェクトを持っています
class obj
{
string a;
string b;
}
そして、私は別の文字列 x を持っています
だから私はどこを削除したい(a+b) == x
以下は、私がやりたいことの例です。
void Main()
{
List<telefone> phones = new List<telefone>()
{
new telefone()
{
ddd = "21", numero="1234"
},
new telefone()
{
ddd = "22",
numero="1234"
}
};
List<string> newPhones = new List<string>(){"1151814088", "11996081170", "098", "890", "99988", "6533"};
for(int i = 0; i < newPhones.Count; i++)
{
phones.Select(x => x.ddd + x.numero).ToList().RemoveAll(x => (x == phones[i]));
}
phones.Dump();
}
public class telefone
{
//[System.Xml.Serialization.XmlIgnore]
internal string hash = String.Empty;
public String ddd { get; set; }
public String numero { get; set; }
public telefone()
{
ddd = String.Empty;
numero = String.Empty;
}
}