简体   繁体   中英

Pass a “non-serialized” object to another appdomain without Serilization/Deserialization (C#)

What is the best way for passing a "non-serialized" object to another appdomain without Serilization/Deserialization ?

More detail: I'm going to invoke a function (from external assembly/plugin) in new appdomain and pass the result to main appdomain (main program). but (unfortunately) the result type is not serializable and therefore i faced to SerializationException

limitations:

the non-serialized type is in external assembly/dll. So i cannot mark it as serializable with attribute.

If you want to pass it through the remoting infrastructure it must be either by ref or serializable.

Since this type is neither you have limited options:

  1. Perform the processing in the remote app domain.
  2. Perform custom serialization to transfer the data you want (not the object). For example, copy the values to a serializable DTO class or use a serializer library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM