Make an ArrayList read-only The ArrayList class implements the IList interface using an array whose size is dynamically increased as required. It is designed to hold heterogeneous collections of objects. ArrayList is not guaranteed to be sorted. The ArrayList capacity is the number of elements it can hold. Its capacity is automatically increased while adding elements. ArrayList elements can be accessed by index and it is zero-based. The ArrayList accepts null as a valid value and also allows duplicate elements. The following .net c# tutorial code demonstrates how we can make an ArrayList read-only. That means we will convert an ArrayList instance to a read-only ArrayList. We also check whether an ArrayList instance is read-only or not. Here we will use the ArrayList class ReadOnly() method to make an ArrayList read-only. We also use the ArrayList class IsReadOnly property to determine whether an ArrayList is read-only or not. A collection that...
Android, .NET C#, Flutter, and Many More Programming tutorials.