Difference between "struct" and "value struct"

What's the difference between

public struct X{
public:
    int A;};

      

and

public value struct X{
public:
    int A;};

      

How can I convert one to the other?

+3


source to share


1 answer


The first is the normal C ++ structure.



Usage value struct

creates a C ++ / CLI value type (.NET framework). Usually you will need to copy one from the other manually, although if the memory layout is the same, you can often use things like Marshal::PtrToStructure

to copy the data directly. Note that this returns the box value struct

, however, so manual copying is often more efficient.

+4


source







All Articles