Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C3610

Error Message

'valuetype': value type must be 'boxed' before method 'method' can be called

By default, a value type is not on the managed heap. Before you can call methods from .NET runtime classes, such as Object, you need to move the value type to the managed heap.

C3610 is only reachable using /clr:oldSyntax.

The following sample generates C3610:

// C3610.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>

__value class A {};

int main() {
   A a;
   a.GetType(); // C3610

   // OK
   __box A* ovar = __box(a);
   ovar->GetType();
}

Community Additions

ADD
Show:
© 2015 Microsoft