dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.29k stars 5.92k forks source link

Serializable attribute seems optional #17832

Closed zerocoins closed 3 years ago

zerocoins commented 4 years ago

"An exception is thrown if you attempt to serialize but the type doesn't have the SerializableAttribute attribute" I just created a simple example to test xml serialization and it all went well without exception being thrown, although I didn't mark my test class with Serializable attribute. It appears that it is optional, not mandatory.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

zerocoins commented 4 years ago

Also it appears that xml serializer ignores NonSerialized attribute and it expects XmlIgnore.

BillWagner commented 4 years ago

Thanks for writing these up @zerocoins This article should be updated to improve the distinctions between XML and binary serialization.

I've added this it to our backlog to update when we next update this area.

dotnet-bot commented 3 years ago

This issue has been closed as part of the issue backlog grooming process outlined in #22351.

That automated process may have closed some issues that should be addressed. If you think this is one of them, reopen it with a comment explaining why. Tag the @dotnet/docs team for visibility.