我需要檢查並顯示包含在列表<>集合中的任何重複項。在列表<>中檢查重複項
//Check for duplicate items
foreach (string y in myListCollection)
{
if (myListCollection.FindAll(x => x.Contains(y)).Count > 1)
{
foreach (string path in myListCollection.FindAll(x => x.Contains(y)))
{
listbox1.items.add(path);
}
}
}
但是,這將返回整個列表。請問我做錯了什麼?
真棒,謝謝! –