Finding the Index which Points Beyond the Last Element in C# Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The Index Structure is introduced in C# 8.0. It represents a type that can be used to index a collection or sequence and it can be started from the start or the end. You are allowed to find the index, which points beyond the last element of the specified collection with the help of End Property provided by the Index struct. Syntax: public static property Index End { Index get(); }; Example 1: CSharp // C# program to illustrate how // to get the End index using System; namespace example { class GFG { // Main Method static void Main(string[] args) { // Creating new indexes // Using Index() constructor var in1 = new Index(1, true); var in2 = new Index(3, false); // Getting the end index var res1 = Index.End; // Displaying the index Console.WriteLine("Index: {0}", in1); Console.WriteLine("Index: {0}", in2); Console.WriteLine("End Index: {0}", res1); } } } Output: Index: ^1 Index: 3 End Index: ^0 Example 2: CSharp // C# program to illustrate the // concept of the End index using System; namespace example { class GFG { // Main Method static void Main(string[] args) { string[] greetings = new string[] {"Hello", "Hola", "Namaste", "Bonjour", "Ohayo", "Ahnyounghaseyo"}; // Get the end index var res = Index.End; // Checking the given index // is the end index or not if (res.Equals (^0) == true) { Console.WriteLine("The given index is "+ "beyond the last element"); } else { Console.WriteLine("The given index is not"+ " beyond the last element"); } } } } Output: The given index is beyond the last element Comment More infoAdvertise with us Next Article C# | Finding the index of last element in the array A ankita_saini Follow Improve Article Tags : C# CSharp-8.0 Similar Reads C# | Finding the index of last element in the array GetUpperBound() Method is used to find the index of the last element of the specified dimension in the array. Syntax: public int GetUpperBound (int dimension); Here, dimension is a zero-based dimension of the array whose upper bound needs to be determined. Return Value:The return type of this method 2 min read C# | Finding the index of first element in the array GetLowerBound() Method is used to find the index of the first element of the specified dimension in the array. Syntax: public int GetLowerBound (int dimension); Here, dimension is a zero-based dimension of the array whose lower bound needs to be determined. Return Value: The return type of this meth 2 min read C# | Gets or Sets the element at the specified index in the List List<T>.Item[Int32] Property is used to gets or sets the element at the specified index. Properties of List: It is different from the arrays. A list can be resized dynamically but arrays cannot. List class can accept null as a valid value for reference types and it also allows duplicate elemen 2 min read Finding the Index of First Element of the Specified Sequence in C# The Index Structure is introduced in C# 8.0. It represents a type that can be used to index a collection or sequence and it can be started from the start or the end. You are allowed to find the index, which points the first element of the specified collection or sequence with the help of Start Prope 2 min read Finding the End Index of the Specified Range in C# The Range Structure is introduced in C# 8.0. It represents a range that has a start and end indexes. You are allowed to find the end index of the given ranges with the help of End Property provided by the Range struct.Syntax:Â Â public property Index End { Index get(); }; Here, Index represents the e 2 min read C# | Get or set the element at the specified index in ArrayList ArrayList.Item[Int32] Property is used to get or set the element at the specified index in ArrayList. Syntax: public virtual object this[int index] { get; set; } Here, index is the zero-based index of the element to get or set. Return Value: It returns the element of Object type at the specified ind 2 min read Like