Hour 24

1: How can you determine at runtime whether an object is serializable? (Hint: Look at the Type class.)
A1: You can call the IsSerializable function provided by the Type class.
2: If you don't want to apply the NonSerializable attribute to several data members, how would you ensure that those values will not be serialized?
A2: Use custom serialization instead of selective serialization.
3: Explain what happens when you serialize an object, add or remove a member variable to that object, and then attempt to deserialize it?
A3: An exception will be thrown because the signature of that object has changed and cannot be deserialized properly.

Get Sams Teach Yourself Visual C++® .NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.