LINQ ElementAt() MethodIn LINQ, ElementAt() operator is used to return the elements from the list/collection based on the specified index. Generally, in the list, the index will start with zero, so if we want to get the first element, then there is a need to send zero (0) as an index position. Syntax of LINQ ElementAt() MethodIn the above syntax, we are getting the element at second index position element from the collection. Example of LINQ ElementAt() MethodHere is the example of using the LINQ ElementAt() method to get the elements at specified index position. From the above example, we are trying to get the different elements in the collection based on the different index positions. Output:
Next TopicLINQ ElementAtOrDefault Method
|