29
1
using System;
2
using System.Collections;
3
using System.Linq;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
Person[] people = {
10
new Person(){ FirstName="Steve", LastName="Jobs"},
11
new Person(){ FirstName="Bill", LastName="Gates"},
12
new Person(){ FirstName="Lary", LastName="Page"}
13
};
14
15
var list = from p in people
16
orderby p.LastName
17
select p;
18
19
Array.ForEach<Person>(list.ToArray<Person>(), p => Console.WriteLine(p.FirstName + " " + p.LastName));
20
}
21
}
22
23
class Person
24
{
25
public int Id { get; set; }
26
public string FirstName { get; set; }
27
public string LastName { get; set; }
28
}
29
Cached Result
06-12-2007