例,数组A{1,3,5},用怎么取得3的索引???高人指点

解决方案 »

  1.   

           //一个数组 
           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;
                    }
                }
            }
      

  2.   

    它和另外一个数据对应years{2009,2010,2011}
    重复肯定有的。。
      

  3.   

    void Main()
    {
    int[]A=new int[]{1,3,5,3,3};
    A.Select((a,index)=>new{a,index}).Where(a=>a.a==3).ToList().ForEach(a=>Console.WriteLine(a.index));
    /*
    1
    3
    4
    */
    }
      

  4.   

    Select,我可以问一下,这个是怎么来的吗?
      

  5.   

    .NET FREAMWORK 3.5
    LINQ
      

  6.   

    A{1,3,5,3,3,3} 这种情况呢?
    版主威武,linq传入索引,这种用法我从来没有用过