- Home /
Question by
Bloodsys · Jan 19, 2018 at 11:28 AM ·
scripting problemserializationxml
How to ignore EventHandler serialization?
I have EventHandler in my program. I tried to add "event" keyword, I tried to use [field:NonSerialized]/[XmlIgnore], but still have System.EventHandler cannot be serialized because it does not have a default public constructor error. Hot to prevent EventHandler serialization?
Comment
The error was on my side: I forget to add XmlIgnore prorerty inside another class, which used in serialized.
Answer by Diukrone · Jan 19, 2018 at 04:41 PM
To serialize / deserialize a class, the serializer requires a parameterless constructor. So, you need to add the parameterless constructors to your classes.
You need to declare the variables inside the function you are making or in the begin of the class file.
Your answer
