Equals(Object) method in ArrayList
In this article I will discuss the Equals(Object) method of ArrayList.
Introduction
Equals(Object) method of ArrayList determines whether the specifiedObject is equal to the current Object or not if yes then it gives the result as true otherwise it gives false.
Example
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
//create the first arraylist
ArrayList arr = new ArrayList();
arr.Add("Red");
arr.Add("Yellow");
arr.Add("Green");
arr.Add("Brown");
arr.Add("Pink");
//create the second arraylist
ArrayList arr1 = new ArrayList();
arr1.Add("sunday");
arr1.Add("monday");
arr1.Add("tuesday");
//apply the Equals method
Console.WriteLine(arr.Equals(arr1));
arr = arr1;
Console.WriteLine(arr.Equals(arr1));
}
}
}
|
Output

Ask Your Question
Got a programming related question? You may want to post your question here