0

i am using a arraylist "distincArray" and i want to find the current value inside the arraylist . for that i have use the contains methods as below.I am still not able to find the element

if (distincArray.Contains(lblCompID.Text))
   {
    distincArray.RemoveAt(distincArray.IndexOf(lblCompID.Text));
   }

can any one help me out ?

4

1 回答 1

0

最佳做法是使用Any函数。

distincArray.Any(x => x == lblCompID.Text)

需要 Linq 库

using System.Linq;
于 2013-10-24T08:02:11.370 回答