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.

using extension methods obfuscates, hides & confuses source of 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:

how extension 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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -