Linq Coding-Part One

Source: Internet
Author: User
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 directory

  1. Linq Coding -- Part One
  2. Linq Coding -- Part Two [standard query operator]
  3. Linq Coding -- Part Three [Let clause]
  4. Linq Coding -- Part Four [Concat application]
  5. Linq Coding -- Part Five (Join Internal Join query)
  6. Linq Coding -- Part Six (Join Group Join)
  7. Linq Coding -- Part Seven (Join: left Outer Join, DefaultIfEmpty, GroupJoin)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.