use ElementAt : ElementAt « LINQ « C# / C Sharp






use ElementAt

 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

public class MainClass{
   public static void Main(){
            int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9};
            var query = numbers.ElementAt(4);
            Console.Write(query);
   }
}

 








Related examples in the same category

1.The element operators extract one element from the input sequence
2.Calling the ElementAt Operator
3.Use ElementAt to print the fourth number less that 5 in an integer array