所以我在列表字典项的集合:C#从列表<>中删除重复的字典项?
List<Dictionary<string, string>> inputData = new List<Dictionary<string, string>>(inputs);
List<Dictionary<string, string>> itemStack = new List<Dictionary<string, string>>();
现在我想做的事情是我想检查itemStack具有相同的值(字典项)已各inputData字典项。
我在想这会是什么样子?
foreach (var item in inputData)
{
if(!itemStack.Contains(item){ itemStack.Add(item)}
else{ //Duplicate found}
}
它不真的检查里面的项目值?它只是假定它没有它... 我只想要的是如果itemStack包含和已经在堆栈中的项目不包括它。 我知道我错过了一些明显的东西。 谢谢,
词典<字符串,字符串>是不够的?为什么让字典的名单<字符串,字符串>? –
在其方式是这涉及到ASP .NET? –
@Tomas我正在遍历每个项目,以检查它的重复 @Tim只是因为它在本网站上的asp.net控制器的事件。我在清理帖子结果并尝试删除重复条目。 – Vinny