I have a [Nonserialized] field in my class that is initialized inline:
[NonSerialized]
private bool running = true;
However, after deserializing an object I have running == false. This is not what I want. Can I force inline initializatin to work for all [NonSerialized] fields? Otherwise I will have to implement ISerializable...
You could set it in the default constructor.
Implement the System.Runtime.Serialization.IDeserializationCallback
It is called afther the object is deserialized so you can perform your extra initialization there .
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