Marshal object


I need to know size of the object.
When I try to use this code:

using System.Runtime.InteropServices;

I get error: Cannot resolve symbol ‘Marshal’. According to MSDN, Marshal type is defined in System.Runtime.InteropServices namespace. But I do not have this type in this namespace. I using Mountaineer Ethernet board.

Now I think I made a mistake with the version of the framework… Sorry.
But how I can calculate size of object at runtime?

This is a simple question with complex answers. Do you mean the size of the object itself plus referenced objects, or just the object itself?

What are you trying to achieve?

I believe

only gets the size of the object but not referenced objects.

I have a some instances of a struct. And want to store it in Mountaineer inner flash memory. I want to create data-logger.
Now, I solved my problem by writting byte-serializer/deserializer. My structs store themselves into a byte array.