Set The “NonSerializedAttribute” To An Auto Property

前端 未结 7 2238
青春惊慌失措
青春惊慌失措 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:21

    For events, you can use [field:NonSerialized], but for auto-properties this does not work. It seems like it would be a very logical way to handle auto-properties as well, but for some reason it doesn't seem to have been implemented.

提交回复
热议问题