The only way to really do this is to look for one of the COM IPersist
interfaces, and then serialize to whatever format it supports (there is
IPersistMoniker, IPersistFile, IPersistStorage, IPersistMemory, etc, etc).
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.comwrote
in message news:D6**********************************@microsof t.com...
Craig,
It sounds like you are asking to serialize an unmanaged object, which is
probably asking a bit too much from the managed CLR. What exactly is it
that
you need to do here? There may be a "managed way".
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com
"cr**********@gmail.com" wrote:
>Is it possible to serialize a COM class for which you don't have the
source code? Obviously it won't work without the [Serializable]
attribute, which I can't add, and implementing ISerializable on a
derived class won't help because I don't have access to the private
fields that I would need to write to a file for the serialization to
be successful.
Is there a way to write the block of memory from a pointer? I could
use Marshal.StructureToPtr() to get a pointer to the object and
Marshal.SizeOf() to determine how much memory it takes up, and write
all of that to a binary file.