我需要从元组列表中查找并删除重复项。基本上,我的结构是这样的:
List<Tuple<string, string>> myList = new List<Tuple<string, string>>();
****
private void FillStructure()
{
myList.Add(Tuple.Create<string, string>("A", "B"));
myList.Add(Tuple.Create<string, string>("A", "C"));
myList.Add(Tuple.Create<string, string>("C", "B"));
myList.Add(Tuple.Create<string, string>("C", "B")); // Duplicate
myList.Add(Tuple.Create<string, string>("A", "D"));
FindAndRemoveDuplicates(myList);
}
private void FindAndRemoveDuplicates(List<Tuple<string, string>> myList)
{
// how can I perform this ?
}
我不能使用字典,因为我可以有相同的键但不同的值!先感谢您