码迷,mamicode.com
首页 > 编程语言 > 详细

C# 判断数组中是否存在某个值

时间:2019-10-11 12:44:26      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:array   htm   div   list   tps   查找   com   bool   网址   

方法1

1 int[] ia = {1,2,3};
2 int id = Array.IndexOf(ia,1); // 这里的1就是你要查找的值

 方法2

1 string[] strArr = {"a","b","c","d","e"};
2 bool exists = ((IList)strArr).Contains("a");

参考网址

  [1] https://www.cnblogs.com/superelement/p/7691229.html

C# 判断数组中是否存在某个值

标签:array   htm   div   list   tps   查找   com   bool   网址   

原文地址:https://www.cnblogs.com/luyj00436/p/11653343.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!