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:
and
for further information, please take @ book clr via c#.
Comments
Post a Comment