hits counter

More On Another Way For Using The “using” Keyword

In the past I presented another possible use for the using keyword: as hints on LINQ.

I’ve been giving some thought about this lately and refined my proposal.

var q = from person in personCollection using MyEnumerableExtensions
        group person by person.LastName into g using new MyOtherComparer()
        orderby g.Key using new MyComparer()
        select person;

The above query would be converted to:

var q = MyEnumerableExtensions.OrderBy<string, Person>(
    MyEnumerableExtensions.GroupBy<string, Person>(
        person => person.LastName,
        new MyComparer(),
    g => g.Key,
    mew MyOtherComparer()

What do you think of this?


Comments have been disabled for this content.