G
Guest
Hi
I am an dotNet newby, so pardon my ignorance.
I am looking for a method of saving/copying a managed class to a stream/file
WITHOUT saving the object's state, eg. if I have a ref class with two int32's
as its data members, the binary file of that class must have a size of 8
bytes (i.e. only contains class data members, not methods etc.).
Is serialization the answer to the above problem? If I understand correctly,
the reason that pointer arithmetic and operations like sizeof(MyRefClass)
don't work is that the managed class is handled by the CLR, which, in turn,
requires objects to be serialized before porting.
In short, is there a serialization method which enables me to store ref
class data members ONLY in the same way as in native C++ (memcpy,etc.) does?
Thanks!
Jacques
I am an dotNet newby, so pardon my ignorance.
I am looking for a method of saving/copying a managed class to a stream/file
WITHOUT saving the object's state, eg. if I have a ref class with two int32's
as its data members, the binary file of that class must have a size of 8
bytes (i.e. only contains class data members, not methods etc.).
Is serialization the answer to the above problem? If I understand correctly,
the reason that pointer arithmetic and operations like sizeof(MyRefClass)
don't work is that the managed class is handled by the CLR, which, in turn,
requires objects to be serialized before porting.
In short, is there a serialization method which enables me to store ref
class data members ONLY in the same way as in native C++ (memcpy,etc.) does?
Thanks!
Jacques