Common Notes
LINQ
LINQ enables a more declarative style of coding for C# and Visual Basic. A LINQ query
describes operations on data through a declarative construct instead of an iterative one.
Observable Collection: Observable collections are to Rx what enumerable collections are to
LINQ.
var query =
from assembly in AppDomain.CurrentDomain.GetAssemblies()
from type in assembly.GetTypes()
from method in type.GetMethods()
where method.IsStatic
&& method.ReturnType.GetInterface( "IEnumerable'1" ) != null
orderby method.DeclaringType.Name, method.Name
group method by new {
Class = method.DeclaringType.Name,
Method = method.Name };
INTO Clause
var developersGroupedByLanguage =
from d in developers
group d by d.Language into developersGrouped
select new {
Language = developersGrouped.Key,
DevelopersCount = developersGrouped.Count()
};
LET Clause
var categoriesByProductsNumberQuery =
from c in categories
join p in products on c.IdCategory equals p.IdCategory
into productsByCategory
let ProductsCount = productsByCategory.Count()
orderby ProductsCount
select new { c.IdCategory, ProductsCount};
LINQ enables a more declarative style of coding for C# and Visual Basic. A LINQ query
describes operations on data through a declarative construct instead of an iterative one.
Observable Collection: Observable collections are to Rx what enumerable collections are to
LINQ.
var query =
from assembly in AppDomain.CurrentDomain.GetAssemblies()
from type in assembly.GetTypes()
from method in type.GetMethods()
where method.IsStatic
&& method.ReturnType.GetInterface( "IEnumerable'1" ) != null
orderby method.DeclaringType.Name, method.Name
group method by new {
Class = method.DeclaringType.Name,
Method = method.Name };
INTO Clause
var developersGroupedByLanguage =
from d in developers
group d by d.Language into developersGrouped
select new {
Language = developersGrouped.Key,
DevelopersCount = developersGrouped.Count()
};
LET Clause
var categoriesByProductsNumberQuery =
from c in categories
join p in products on c.IdCategory equals p.IdCategory
into productsByCategory
let ProductsCount = productsByCategory.Count()
orderby ProductsCount
select new { c.IdCategory, ProductsCount};
Comments
Post a Comment