P
P
Piligr1m2015-11-18 12:44:40
C++ / C#
Piligr1m, 2015-11-18 12:44:40

How to mark a class as [Serializable] if it is loaded from a dll?

I am using dll files in my project. How can I mark a class as serializable with the [serializable] attribute?
I don't have the source code, only the dll file that is referenced in my class.
I want to make it serializable in order to use the view state for my object which is using the dll. I am using binary serialization.
How to solve the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Piligr1m, 2015-11-19
@Piligr1m

The solution is, if there is only one class, then it makes sense to use the Surrogate Selector mechanism.
If there are many such classes, then it makes sense to use another serializer ServiceStack.Text, Json.NET, FsPickler or another

S
Sergey, 2015-11-18
@sergey_kzn

Write your own proxy class for the one you need. In your class, mark and implement whatever you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question