C# C# Console Application

ArrayList LastIndexOf() method in C#1 min read

.Net framework ArrayList.LastIndexOf(Object) method allow us to search the specified Object and return the zero-based index of the last occurrence within the entire ArrayList. the arraylist LastIndexOf() method exists in System.Collections namespace.

this method require to pass a parameter named ‘value’. the ‘value’ parameter value type is System.Object which represents the Object to locate in the arraylist. this value can be null.

the LastIndexOf() method return value data type is System.Int32. this return integer value is the zero-based index of the last occurrence of the ‘value’ within the entire arraylist if the object found in arraylist; otherwise the method return -1. if the arraylist contains same object multiple times then the method return last occurrence index of the specified object.

the following console c# example code demonstrate us how can we get the last occurrence index of a specified object within an arraylist programmatically at run time in an console application.

C# Code:




Leave a Comment