Linq Search Process

Linq To ArrayList

public class Student

{

public String FirstName
{ get; set; }

public String LastName
{ get; set; }

public Int32[] Scores
{ get; set; }
}

public class LinqToArrayList : Interface

{

Interface Members#region Interface Members

public void invoke()

{
ArrayList arrList = new ArrayList();
arrList.Add(
new Student

{
FirstName = "Svetlana",
LastName = "Omelchenko",

Scores = new int[]
{ 98, 92, 81, 60 }
});
arrList.Add(
new Student

{
FirstName = "Claire",
LastName = "O’Donnell",

Scores = new int[]
{ 75, 84, 91, 39 }
});
arrList.Add(
new Student

{
FirstName = "Sven",
LastName = "Mortensen",

Scores = new int[]
{ 88, 94, 65, 91 }
});
arrList.Add(
new Student

{
FirstName = "Cesar",
LastName = "Garcia",

Scores = new int[]
{ 97, 89, 85, 82 }
});
var query = from Student student in arrList
where student.Scores[0] > 95
select student;
foreach (Student s in query)
Console.WriteLine(s.LastName + ": " + s.Scores[0]);

Console.WriteLine("press any key to exit.");
Console.ReadKey();
}

#endregion
}

LINQ Coding 目录
- Linq Coding -- Part One
- Linq Coding -- Part Two[标准查询运算符]
- Linq Coding -- Part Three [Let子句]
- Linq Coding -- Part Four[Concat应用]
- Linq Coding -- Part Five (Join之内部联接查询)
- Linq Coding -- Part Six (Join之分组联接)
- Linq Coding -- Part Seven (Join之左外部联接、DefaultIfEmpty、GroupJoin)
posted @
2008-02-26 11:29
RicoRui
阅读(
1701)
评论()
收藏
举报