views:

173

answers:

5

Hi, I need serialize a Com Object using .net using c# or Delphi .Net is this possible? Bye.

+1  A: 

You could probably do this by wrapping the COM object in a (serializable) .NET class, exposing the fields that you want serialized.

jpoh
A: 

You can get a Managed Object through GetObjectForIUnknown Method. And then, you can serialize this managed object.

Aamir
+3  A: 

Check to see if you COM object implements IPersistStream, IPersistMemory or any other of the IPersist variants -- that would be your best bet.

JP Alioto
The Com Object does not implements any IPersistent variant.
RRUZ
A: 

I am not sure there will be difference in how you serialize your data in C++, .Net or in any other language. COM object is like a class and can be serialized by getting each data member and serializing it .I did like this in C++.

I think this should be same in .Net unless there are specific APIs to do it.

Alien01
A: 

Not simply by passing object to serializer - implement ISerializable interface on COM object wrapper (primary interop assembly is a wrapper too) and define your own serialization.

ima