.net - When calling an object method on an integer literal (such as ToString), is the CLR boxing the literal first? -


i wonder if boxing taking place in order tostring() called on integer literal (5):

5.tostring(); 

oh, , if not, taking place in order clr able call tostring() method?

no, doesn't require boxing - because int overrides tostring. compiler can determine method called, doesn't need go through virtual dispatch. doesn't use callvirt - call correspond il of

call instance string [mscorlib]system.int32::tostring() 

if don't override tostring() (etc) in struct, calls virtual method require boxing.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -