C# 获取数组元素的索引
例,数组A{1,3,5},用怎么取得3的索引???高人指点
------解决方案-------------------- //一个数组
int[] A = new int []{1,4,5};
//判断是否存在于数组中
bool isContains = A.Contains(4);
if (isContains)
{
for (int i = 0; i < A.Length; i++)
{
if (A[i] == 4)
{
Response.Write("the index from 0 in the arrry is " + i);
break;
}
}
}