Skip to content

xiong-ang/LINQDemo

Repository files navigation

Linq

Key Words

  • Filter
    • from
    • in
    • where
  • Order
    • orderby
    • descending
    • ascending
  • Projecting
    • select
  • Join
    • join
    • in
    • on
  • Group
    • group
    • by
    • into
  • Aggregate
    • Aggregate
  • Others
    • equals
    • let
  • Most userful
    • from * in * where * select *

Examples

var innerJoinQuery =
            from category in categories
            join prod in products on category.ID equals prod.CategoryID
            select new { ProductName = prod.Name, Category = category.Name };
var earlyBirdQuery =
            from sentence in strings
            let words = sentence.Split(' ')
            from word in words
            let w = word.ToLower() //How to use "let"
            where w[0] == 'a' || w[0] == 'e'
                || w[0] == 'i' || w[0] == 'o'
                || w[0] == 'u'
            select word;

Demo

Requirement: Get ranks of student by credit and score.

About

Some Demo for LINQ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages