Question

On .net, value types are stored on the stack and reference types on the heap (and it's reference on the stack).

But if a variable is marked as dynamic, is this rule still valid based on the run-time type of the data?

I was looking for some reference that points to this, but didn't find any.

Était-ce utile?

La solution

A variable of type dynamic is a System.Object at runtime. So it is always a reference to an object that's stored on the GC heap. If you assign a value type value to the variable then it will be boxed with a standard boxing conversion.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top