c# - How do extension methods work under-the-hood? -
c# - How do extension methods work under-the-hood? -
a contractor work using extension methods
implement crud
on well-known internal classes own. improve utilize normal inheritance
on extension methods
next reasons.
crud
methods. i assume extension methods
create heavy utilize of reflection
(which slower). his logic is, "it's compiled, it's fast." maybe i'm wrong...but because compiled doesn't mean doesn't utilize reflection, nor mean faster normal inheritance.
so questions are:
howextension methods
work under-the-hood? is improve utilize inheritance
or extension methods
on well-known classes own?
how extension methods work under-the-hood?
they're static methods; compiler rewrites calls myobject.myextensionmethod()
myextensionclass.myextensionmethod(myobject)
.
is improve utilize inheretance or extension methods on well-known classes own?
there's not single reply question, depends on context. extension methods useful in cases:
you don't own code extended type the method targets interface , same implementations of interface (e.g.ienumerable<t>
, linq extension methods) c# asp.net extension-methods
Comments
Post a Comment