will following code cause boxing of integer passed call genericmethod?
void genericmethod<t>(t value) { int test = (dynamic)value; } void main() { genericmethod(100); }
according c# specification §4.7 dynamic type:
dynamicconsidered identicalobjectexcept in following respects:
operations on expressions of type
dynamiccan dynamically bound (§7.2.2).type inference (§7.5.2) prefer
dynamiconobjectif both candidates.
so, casting dynamic cause boxing in same way casting object.
Comments
Post a Comment