Groups | Blog | Home
all groups > dotnet interop > may 2005 >

dotnet interop : Prevent a field from being marshaled?


Bob
5/29/2005 5:46:35 PM
Is there a way to prevent a method from being marshaled in functions like
Marshal.PtrToStructure()? I've tried NonSerializableAttribute and
ComVisibleAttribute, but they don't effect Marshal.SizeOf(). Basically I
just want the marshaler to ignore a certain field, leaving it
unitialized/zero if marshaling from unmanaged code.

Thanks

Mattias Sjögren
5/30/2005 7:41:14 AM

[quoted text, click to view]

No, you'll have to declare a type without that field, and then copy
the contents over to your original type.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button