Finding the End Index of the Specified Range in C# Last Updated : 28 Jun, 2021 Comments Improve Suggest changes Like Article Like Report 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 end index.Example 1: CSharp // C# program to illustrate the use // of End property of Range struct using System; namespace range_example { class Program { static void Main(string[] args) { // Creating range // using Range Constructor var r1 = new Range(0, 5); // Creating range // using range operator Range r2 = 3..7; // Finding the last index // of r1 and r2 ranges // Using End property var res1 = r1.End; Console.WriteLine("End index of r1 range: " + res1); var res2 = r2.End; Console.WriteLine("End index of r2 range: " + res2); } } } Output: End index of r1 range: 5 End index of r2 range: 7 Example 2: CSharp // C# program to illustrate how to use // End property of Range structure using System; namespace range_example { class GFG { // Main Method static void Main(string[] args) { // Creating and initializing an array string[] arr = new string[8] {"Archery", "Badminton", "Cricket", "Bowling", "Boxing", "Curling", "Tennis", "Skateboarding"}; // Creating ranges // Using Range(Index, Index) // Constructor var r1 = new Range(0, 3); var r2 = new Range(4, 7); // Finding the last index // of the specified range // Using End property var res1 = r1.End; var res2 = r2.End; Console.WriteLine("End Index of Range {0} is {1}"+ " and the item is {2}", r1, res1, arr[res1]); Console.WriteLine("End Index of Range {0} is {1} and"+ " the item is {2}", r2, res2, arr[res2]); } } } Output: End Index of Range 0..3 is 3 and the item is Bowling End Index of Range 4..7 is 7 and the item is Skateboarding Comment More infoAdvertise with us Next Article Finding the End Index of the Specified Range in C# ankita_saini Follow Improve Article Tags : C# CSharp-8.0 Similar Reads Finding the Start Index of the Specified Range in C# The Range Structure is introduced in C# 8.0. It represents a range that has start and end indexes. You are allowed to find the start index of the given range with the help of the Start Property provided by the Range struct.Syntax:Â Â public property Index Start { Index get(); }; Here, Index represent 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 Getting the Hash Code 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 get the hash code of the specified range with the help of the GetHashCode() Method provided by the Range struct. This method returns the hash code of the specified instance. Syntax 2 min read C# | Getting the index of the specified key in a SortedList object SortedList.IndexOfKey(Object) Method is used to get the zero-based index of the specified key in a SortedList object. Syntax: public virtual int IndexOfKey (object key); Here, key is the Key which is to be located in the SortedList object. Return Value: This method returns the zero-based index of ty 3 min read 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# | Searching the index of specified object in Collection<T> Collection<T>.IndexOf(T) method is used to search for the specified object and returns the zero-based index of the first occurrence within the entire Collection<T>. Syntax: public int IndexOf (T item); Here, item is the object to locate in the List<T>. The value can be null for ref 2 min read C# | Getting index of the specified value in a SortedList object SortedList.IndexOfValue(Object) Method is used to get the zero-based index of the first occurrence of the specified value in a SortedList object. Syntax: public virtual int IndexOfValue (object value); Here, value is the Value which is to be located in the SortedList object. The value can be null. R 3 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 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 How to Create a Range to a Specified End 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 a Range object starting from the first element of the specified collection or sequence to a specified end index with the help of EndAt() Method provided by the Range structure. Or 2 min read Like