List移除相同的字串
//List移除相同的字串
private List<string> removeDuplicates(List<string> inputList) {
Dictionary<string, int> uniqueStore = new Dictionary<string, int>();
List<string> finalList = new List<string>();
foreach (string currValue in inputList) {
if (!uniqueStore.ContainsKey(currValue)) {
uniqueStore.Add(currValue, 0);
finalList.Add(currValue);
}
}
return finalList;
}
標籤: C#
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁