Common Classes

Several of the examples in this chapter require classes to fully demonstrate an operator's behavior. This section describes four classes that will be shared by more than one example, beginning with the Employee class.

The Employee class is meant to represent an employee. For convenience, it contains static methods to return an ArrayList or array of employees.

Example. The Shared Employee Class
public class Employee { public int id; public string firstName; public string lastName; public static ArrayList GetEmployeesArrayList() { ArrayList al = new ArrayList(); al.Add(new Employee { id = 1, firstName = "Joe", lastName = "Rattz" }); al.Add(new Employee { id = 2, firstName = "William", lastName = "Gates" }); al.Add(new Employee { ...

Get Pro LINQ: Language Integrated Query in C# 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.