ArrayList Contains() method in C# – Programming Code Examples
C# C# Console Application

ArrayList Contains() method in C#1 min read

.Net framework ArrayList Contains() method allow us to determine whether an element is in the ArrayList. this arraylist Contains() method exists under System.Collections namespace. this Contains() method has a required parameter named ‘item’.

the ‘item’ property value type is System.Object, which represents the Object to locate in the ArrayList. the value can be null. Contains() method return value data type is System.Boolean. this method return ‘true’, if the ‘item’ is found in the arraylist; otherwise method return ‘false’.




the Contains() method implements as IList.Contains(Object) and this method perform a linear search. Contains() method determines equality by calling Object.Equals.

the following console c# example code demonstrate us how can we determine whether an element exists in arraylist programmatically at run time in an console application.

C# Code:

 

Output:

 

Leave a Comment