SoFunction
Updated on 2025-03-06

C# method to check whether the specified object exists in the ArrayList collection

This article describes the method of C# checking whether a specified object exists in an ArrayList collection. Share it for your reference. The specific analysis is as follows:

C#'s ArrayList provides a dedicated Contains method to detect whether the ArrayList contains the specified object. The return value is a bool type

ArrayList alcollect = new ArrayList();
// Add individual items to the collection
string str = "learn csharp";
(str);
//check existence of object
if((str))
{
  ((str));
}
else
{
  ("Not found!");
}

I hope this article will be helpful to everyone's C# programming.