I am looking at somebody elses C# code and before a public enum there are the following lines:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
Can somebody explain in plain english what the SerializableAttribute line are does?
I already came across this page – it didn’t make much sense to me – I’m new at C#.
The System.SerializableAttribute specifies to the runtime that the instances of that class can be serialized
Eg. You return an object in a WCF service call. If that object has this attribute and all of the objects inside it are serializable, the runtime will transform that object to JSON or XML, depending on the type of resource the web service returns.