The LinQ in Action learns the first chapter example.

Source: Internet
Author: User

Recently, using the entity Framework to do a small example of MVC, found that the Code with LINQ syntax is still a lot of, decided to study LINQ, to fill in the. NET technology, is not everyone is familiar with these technologies, because the project is simple, not how to use.

Reference book LINQ in Action the English version of the comparison, also do not know this is not the best introduction of LINQ books, see the online evaluation is still possible. You can download it at the Peel House. If there is a better book recommendation, please leave a message to me

The first chapter: a Brief introduction to LINQ, or start with writing code.

One: Hello LINQ World: This example is too simple to see the benefits of LINQ, so keep looking at the second example.

//linq Code
string[] words = {"Hello", "Wonderful", "LINQ", "Beautiful", "World"};
var hellolinq = from worldlinq in words
where Worldlinq. Length <= 5
Select Worldlinq;
foreach (var h in hellolinq)
        {
Console.Write (h);
        }
// old general code
foreach (String hl in words)
        {
if (hl. Length <= 5)
            {
Console.Write (HL);
            }
        }
Console.readkey ();

Two: Hello Linq World Order and group

Three:

The LinQ in Action learns the first chapter example.

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.