Set The “NonSerializedAttribute” To An Auto Property

前端 未结 7 2360
青春惊慌失措
青春惊慌失措 2021-02-18 18:59

This cannot be done in C#. Any way to do it?

...

laugh, in case my little pun wasn\'t understood, what I mean is: how can I mark a property in C# as Non

相关标签:
7条回答
  • 2021-02-18 19:32

    [NonSerialized] public decimal yourproperty;

    (decimal as example.)

    Also remember, if you want enable your class to initialize a nonserialized member automatically, use the IDeserializationCallback interface and then implement IDeserializationCallback.OnDeserialization.

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