c# - Set The "NonSerializedAttribute" To An Auto Property -
this cannot done in c#. way it?
...
laugh, in case little pun wasn't understood, mean is: how can mark property in c# nonserialized? of course, when property contains logic, it's natural unable it, auto-properties serializable, and, such, expect have way allow me prevent serialization.
edit * : auto implemented properties backed anonymous field don't have access to, attributes designed controlled reflection based mechanism. these fields cannot referenced reflection mechanism (because anonymous). compiler feature require lot of changes generation of auto-properties... require compiler treat auto-properties fields purpose of marking field attributes onto them.
to answer more fundamental part of question - point auto-properties serialized , there should way control serialization. you're right - auto properties meant shorthand , never designed give full flexibility, rather allow extend functionality "long" way if ever needed it.
- i added more details answer comments body of answer.
Comments
Post a Comment