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


欢迎加群交流技术