File: Employee.cs
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
public class Employee
{
public string _firstName;
public string _lastName;
public bool _retired;
public string FirstName
{
get { return _firstName; }
}
public string LastName
{
get { return _lastName; }
}
public bool Retired
{
get { return _retired; }
}
public Employee(string firstName, string lastName, bool retired)
{
_firstName = firstName;
_lastName = lastName;
_retired = retired;
}
public static IEnumerable Select()
{
EmployeesDataContext db = new EmployeesDataContext();
return db.Employees.OrderBy( e=>e.LastName );
}
}
File: Default.aspx
<%@ Page Language="C#" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Show LINQ