Finding an Element position in LINQ.

vishalneeraj-24503
Posted by vishalneeraj-24503 under LINQ category on | Points: 40 | Views : 460
Suppose,we have a List as below:-
Using System.LINQ;
List<int> lst_numbers = new List<int>{10,20,30,40,50};

Now,to get value at specified position,we have to use ElementAt method which takes an Integer number which is treated as an Index Position.It always starts from 0th position.
Response.Write(lst_numbers.ElementAt(1));
Output:20
Response.Write(lst_numbers.ElementAt(2));
Output:30

Comments or Responses

Login to post response