c# - Where does CLR store methods for instances of one type -


class myclass {      public string myproperty { get; set; }       public void mymethod()      {           //do difficult here           //100500 lines of code here ...      } } 

we have lot of instances of myclass.

does clr creates memory-expensive mymethod() for instance of class?

no not. method compiled once, when have first call of method. compiled code used instance of type myclass. performance hit happens in first call of method, il code compiled native code.

below, posted 2 images may make more clear:

enter image description here

and

enter image description here

for further information, please take @ book clr via c#.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -