您的位置:首页 > 其它

判断数组中是否有重复的数据

2018-03-12 15:35 971 查看

 

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;
}

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: