Tag: ArrayList
How to Check if the ArrayList is read-only in C# ?
There are times when you would use the read-only wrapper in order to prevent modifying the ArrayList. We use the ArrayList.ReadOnly method to create such collection. When doing so , you might want to check if the ArrayList is Read-only or not. How to Check if the ArrayList is read-only in C# ? Use the IsReadOnly property defined in the ArrayList object to check this.
How to Get the number of elements in ArrayList in C# ?
Here’s the code that demonstrates how one can get the total number of elements contained in the ArrayList using C# using the Count property of the ArrayList. How to Get the number of elements in ArrayList in C# ?
How to Add range of elements to ArrayList in C# ?
You can use the AddRange method of the ArrayList object to add the range of elements (string array) to ArrayList in C#. How to Add range of elements to ArrayList in C# ? Here’s the code that demonstrates how to do it.