110,534
社区成员
发帖
与我相关
我的任务
分享
if (b)
{
//有重复项
MessageBox.Show("有重复项");
}
else
MessageBox.Show("无重复项");
string str = "1232432145,123432432,1234324,1234324";
string[] strArr = str.Split(',');
//实例化对象
Dictionary<string,int > dic = new Dictionary<string,int >();
bool b = false;
foreach(string s in strArr)
{
if(dic.ContainsKey(s))
{
b = true;
break;
}
dic.Add(s, 0);
}
string str = "1232432145,123432432,1234324,1234324";
if (str.Split(',').Distinct().ToList().Count != str.Split(',').Count())
//有重复项