[C#] C#检查指定的对象是否存在于ArrayList集合中 →→→→→进入此内容的聊天室

来自 , 2020-04-18, 写在 C#, 查看 218 次.
URL http://www.code666.cn/view/6fb52e71
  1. ArrayList alcollect = new ArrayList();
  2.  
  3. // Add individual items to the collection
  4.  
  5. string str = "learn csharp";
  6. alcollect.Add(str);
  7.  
  8. //check existence of object
  9. if(alcollect.Contains(str))
  10. {
  11.         Console.WriteLine(alcollect.IndexOf(str));
  12. }
  13. else
  14. {
  15.         Console.WriteLine("Not found!");
  16. }
  17. //csharp/7612

回复 "C#检查指定的对象是否存在于ArrayList集合中"

这儿你可以回复上面这条便签

captcha