Extension method in c# -


this question has answer here:

what difference between following 2 implementaion,if no difference why need extension methods ? (public static list<tsource> tolist<tsource>(this ienumerable<tsource> source);)

1.ienumerable<student> myextension = mtystudent; // "mtystudent colletion"     myextension.tolist();  2.list<student> mystudent= enumerable.tolist(myextension); 

there no difference. call same method either way. enumerable.tolist<tsource>(this ienumerable<tsource> source) extension method. static method in enumerable class, can call instance method. extension methods really.


Popular posts from this blog

javascript - Js, document.getElementById("ID").innerHTML, error -

jquery - jqGrid update specific column data with out refreshing the entire column? -

objective c - Is there a way in OCMockito to make stubs fail when an unknown method is called? -