Working with LINQ ToArray Example with Sorting.

vishalneeraj-24503
Posted by vishalneeraj-24503 under LINQ category on | Points: 40 | Views : 666
Import System.LINQ namespace
using System;
using System.Linq;

int[] array1 = {6,5,4,1,2,3,9,8,11};

var query = from element in array1
orderby element
select element;

int[] array2 = query.ToArray();

foreach (int value in array2)
{
Response.Write(value);
}


Output:-
1
2
3
4
5
6
8
9
11

Comments or Responses

Login to post response