Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var query = from person in people
- where person.Age == person.GetHashCode()
- select person;
- let foo = item.Property.SomeNullableType
- let foo = item.Property != null ? item.Property.SomeNullableType : null
- //this is ok
- var results = db.Orders
- .GroupBy( o => o.CustomerID )
- .Select(g => new
- {
- CustomerId = g.Key,
- OrderCount = g.Count()
- });
- //this could be a lot of round trips.
- var results = db.Orders
- .GroupBy( o => o.CustomerID )
- .Select(g => new
- {
- CustomerId = g.Key,
- OrderIds = g.Select(o => o.OrderId)
- });
- // this is ok
- // used ToList to separate linqtosql work from linqtoObject work
- var results = db.Orders
- .Select(o => new {o.CustomerId, o.OrderId})
- .ToList()
- .GroupBy(o => o.CustomerId)
- .Select(g => new
- {
- CustomerId = g.Key,
- OrderIds = g.Select(o => o.OrderId)
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement