111,126
社区成员
发帖
与我相关
我的任务
分享if(Array.IndexOf(str,f)>-1)//存在
int[] ar ={ 1, 2, 3, 65 };
int index = Array.IndexOf<int>(ar, 65);
Console.WriteLine(index);
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
namespace CSDN
{
class Application
{
static void Main(string[] args)
{
string[] sList ={ "a","b","c","d" };
bool b = false;
foreach (string s in sList)
{
if (s == "f")
{
b = true;
break;
}
}
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>(sList);
b = list.Contains("f");
}
}
}