Get element at specific position in CSharp

Description

The following code shows how to get element at specific position.

Example


using System;//from www.j a v a 2  s . c  om
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;


public class MainClass{

   public static void Main(string[] args){   
         String[] TestData = {"Zero", "One", "Two", "Three",
                              "Four", "Five", "Six", "Seven", 
                              "Eight", "Nine", "Ten"};

         var ThisQuery = TestData.ElementAt(5);

         Console.WriteLine("Fifth Element: " + ThisQuery);


   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ