Order by value itself in CSharp
Description
The following code shows how to order by value itself.
Example
// w w w . j av a 2 s.c o m
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
static void Main(string[] args)
{
string[] names = {"Zheng", "Smith" };
var queryResults = names.OrderBy(n => n).Where(n => n.StartsWith("S"));
foreach (var item in queryResults)
{
Console.WriteLine(item);
}
}
}
The code above generates the following result.