Does “default” serialization in C# serialize static fields?

前端 未结 1 1940
猫巷女王i
猫巷女王i 2020-12-18 18:09

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条回答
  • 2020-12-18 18:14

    No; static fields are not serialized.

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

    0 讨论(0)
提交回复
热议问题