
(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
评价
排名
4
文章
473
粉丝
3
评论
2
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256


欢迎加群交流技术