C# C# Console Application

ArrayList Item property in C#1 min read

.Net framework ArrayList Item property allow us to get or set the element at the specified index. the arraylist Item property exists under System.Collections namespace. this property require to pass a parameter named ‘index’.

the ‘index’ parameter value type is System.Int32. this integer value represents the zero-based index of the element to get or set. this Item property return value type is System.Object which represents the element at the specified index. this arraylist Item property implements as IList.Item.




arraylist Item property throw ArgumentOutOfRangeException exception, if the ‘index’ is less than zero or ‘index’ is equals to or greater than Count. arraylist accepts null as a valid value and arraylist also allow duplicate elements.

the following console c# example code demonstrate us how can we get or set (change) arraylist element at the specified index programmatically at run time in an console application.

C# Code:

 

Output:

 

Leave a Comment