I have a class which contains a List<Func<T>>
. The class is serializable and will be transferred over WCF. Now, I have problems with contained List<Func<T>>
. What can I do that this list will also be serializable?
A List can be serialized—here we serialize (to a file) a List of objects.
Use json. dumps() to serialize a list into a JSON object. Use json. dumps(list) to serialize list into a JSON string.
In Java, ArrayList class is serializable by default. It essentially means that we do not need to implement Serializable interface explicitly in order to serialize ArrayList. We can directly use ObjectOutputStream to serialize ArrayList, and ObjectInputStream to deserialize an arraylist object.
The serialize() function converts a storable representation of a value. To serialize data means to convert a value to a sequence of bits, so that it can be stored in a file, a memory buffer, or transmitted across a network.
How would you expect a Func<T>
to be serialized? It's a pointer to a function - such a thing cannot be serialized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With