C#的ArrayList提供了一个专用的Contains方法来检测ArrayList是否包含指定的对象,返回值是一个bool类型
ArrayList alcollect = new ArrayList();
 
// Add individual items to the collection
 
string str = "learn csharp";
alcollect.Add(str);
 
//check existence of object
if(alcollect.Contains(str))
{
   	Console.WriteLine(alcollect.IndexOf(str));
}
else
{
	Console.WriteLine("Not found!");
}




