C#查询数组中是否存在某元素(转载)

来源:https://blog.csdn.net/beautifulsarah/article/details/53489065

法二: int[] ia = {1,2,3}; int id = Array.IndexOf(ia,value); if(id==-1) 不存在 else 存在

法一: string[] s1 = new string[3] { "John", "Paul", "Mary" }; if (s1.Contains("John")) Response.Write("fadfadfa");



posted @ 2022-08-24 14:28  hao_1234_1234  阅读(881)  评论(0编辑  收藏  举报