判断数组中是否有重复的数据
程序员文章站
2022-07-06 19:37:58
public bool IsRepeat(string[] yourValue) { Hashtable ht = new Hashtable(); for (int i = 0; i < yourValue.Length - 1; i++) { if(ht.Contains(yourValue[i... ......
public bool IsRepeat(string[] yourValue) { Hashtable ht = new Hashtable(); for (int i = 0; i < yourValue.Length - 1; i++) { if(ht.Contains(yourValue[i])) { return true; } else { ht.Add(yourValue[i], yourValue[i]); } } return false; }