How extension methods work in background ?
- by Freshblood
I am just cuirous about behind of extension method mechanism.Some questions and answer appear in my mind.
MyClass.OrderBy(x=>x.a).OrderBy(x=>x.b);
I was guessing that mechanism was first orderby method works and order them by a member then returns sorted items in IEnumarable interface then next Orderby method of IEnumarable Order them for b paramater.But i am wrong when i look at this linq query.
MyClass.Orderby(x=>x.a).ThenOrderBy(x=>x.b);
this is slightly different and tells me that i am wrong.Because this is not ordering by a then b and not possible to have such result if i was right.This get me confuse enough...
Similiar structure is possible to write withot extension methods as first query but second is not possible.This prove i am wrong . Can u explain it ?