Um.
GCHandle.AddrOfPinnedObject[
^] returns a pointer to the object memory, which on a 64 bit system will be a 64 bit value.
int
in C# is a 32 bit value, so casting a 64 bit pointer to an
int
will probably render it useless.
Plus, the value you get as an
int
is a partial address, not a size, so this line:
byte[] Data = new byte[(int)Object];
will generate a fairly random sized data object.
I'm not at all sure what you are trying to accomplish with this code, but I can be sure that isn't the right way to do it!