Does “default” serialization in C# serialize stati

2019-02-16 04:24发布

问题:

By "default" I mean just using the [Serializable] attribute on the class. I want to say that no, static fields would not be serialized, but I'm not exactly sure.

回答1:

No; static fields are not serialized.

.Net serialization serializes instances; static fields do not belong to an instance.