Taking a practice exam the exam said I got this one wrong. The answer marked in Yellow is the supposed correct answer.
In the following quote, the part marked in bold I think is wrong: "The Serializable attribute is not inherited by the derived classes, so if you only mark the Encyclopedia class with the Serializable attribute, the runtime will throw an exception when trying to serialize the Name field".
I actually created a sample project with an Animal
class and a Cat
class that derives from it. I marked the Cat
class [Serializable]
and the Animal
class is not.
I was able to successfully serialize and deserialize the Cat
class, including the Animal
properties.
Is this a .NET version issue? The exam is 70-536, so it's targeting 2.0.