from order in ...
select order.OrderItems.Count()
In this query, the
var query = from s in Students
join a in Addresses on s.AdressID equals a.ID into addresses
from a in addresses
select new { s, a };
var query = from s in Students
join a in Addresses on s.AdressID equals a.ID
select new { s, a };
var query = from s in Students
where s.First == "Hugo"
select s;
var result = (from s in Students
select s).Aggregate(0, (totalAge, s) => totalAge + s.Age);
var result = (from s in Students
select s.Name).Aggregate((allNames, name) => allNames + " " + name);
var result = (from s in Students
select s).All();
var result = (from s in Students
select s).Any();
var query = (from s in Students
select s.ID).Average();
var query = (from s in Students
select s.ID).Cast<int>();
var query = (from s in Students
select s).Concat(students2);
var query = (from s in Students
select s).Contains (student);
var query = (from s in Students
select s).Count();
var query = (from s in Students
select s).DefaultIfEmpty ("student");
var query = (from s in Students
select s).Distinct();
var query = (from s in Students
select s).Except(students2);
var query = (from s in Students
select s).First();
var query = from s in Students
where s.First == "Hugo"
group s by s.Country;
var query = (from s in Students
select s).Intersect(students2);
var query = (from s in Students
select s).Last();
var query = (from s in Students
select s).LongCount();
var query = (from s in Students
select s.ID).Max();
var query = (from s in Students
select s.ID).Min();
var query = (from s in Students
select s.ID).OfType<int>();
var query = (from s in Students
select s).Reverse();
var query = (from s in Students
select s).Single();
var query = (from s in Students
select s).Skip (3);
var query = (from s in Students
select s.ID).Sum();
var query = (from s in Students
select s).Take(3);
var query = (from s in Students
select s).Union(students2);
x.GroupBy (k => key, e => element, (k, g) => result)
is therefore equivalent to:
c.GroupBy (k => key, e => element).Select (grouping => resultSub)
where resultSub is the same as result with k and g substituted with grouping.Key and grouping, respectively.
MainSource (...)
.Select (x => x)
.Distinct ()
.Select (x => x)
Naively, the last Select node would resolve (via Distinct and Select) to the
MainSource (MainSource (...).Select (x => x).Distinct ())
.Select (x => x)
Now, the last Select node resolves to the new
from c in Customers
from o in (from oi in OrderInfos where oi.Customer == c orderby oi.OrderDate select oi.Order)
orderby o.Product.Name
select new { c, o }
This will be transformed into:
from c in Customers
from oi in OrderInfos
where oi.Customer == c
orderby oi.OrderDate
orderby oi.Order.Product.Name
select new { c, oi.Order }
As another example, take the following query:
from c in (from o in Orders select o.Customer)
where c.Name.StartsWith ("Miller")
select c
(This query is never produced by the
from o in Orders
where o.Customer.Name.StartsWith ("Miller")
select o
("o", o);
}
]]>
In some other cases, the input value is returned unmodified. This makes it easier to use the argument checks in calls to base class constructors
or property setters:
[BaseTypeRequired(typeof(IComponent)] // Specify requirement
public class ComponentAttribute : Attribute
{}
[Component] // ComponentAttribute requires implementing IComponent interface
public class MyComponent : IComponent
{}
Function definition table syntax: