Is there any difference if I leave the parentheses around queryable and OrderByDescending(...) (and before Take(1)) or remove them? Why or why not?
public static IQueryable<IEffectiveDated> GetCurrent(this IQueryable<IEffectiveDated> queryable, DateTime asOfDate)
{
return (queryable
.Where(e => e.EffectiveDate <= asOfDate)
.OrderByDescending(e => e.EffectiveDate))
.Take(1);
}
There’s no difference in this case. In other words:
is identical to:
The later is probably cleaner and better shows the Linq chaining.