分类:
ASP.NET
(1) 第一种方法:
int[] ia = {1,2,3};int id = Array.IndexOf(ia,1); // 这里的1就是你要查找的值if(id==-1)// 不存在else// 存在
(2) 第二种方法:
string[] strArr = {"a","b","c","d","e"};bool exists = ((IList)strArr).Contains("a");if(exists)// 存在else// 不存在
转载:https://www.cnblogs.com/superelement/p/7691229.html
评价