Home > Code > LINQ > Order by, select (lambda expressions) in Linq

Order by, select (lambda expressions) in Linq

by Narain Siddharth   on Dec 12, 2011   Category: LINQ   |  Views: 1860    |  Points: 25   |  Silver 

See the below C# sample code for select and Order by lambda expression operators.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
public partial class testForm : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
string[] country = { "india", "Morocco", "Canada",
"Switzerland", "Kenya", "Brazil",
"Cyprus", "Senegal","Finland","Algeria","Maldives" };
IEnumerable<string> GetCountry = from listOfcountries in country
orderby listOfcountries
select listOfcountries;

foreach (string strCountry in GetCountry)
Response.Write(strCountry + "<br>");

Post Code  |  Code Snippet Home

User Responses

No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts