当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How to exclude property or field from all sorts of Serializations

问题描述:

I want to develop a class and exclude some of it's properties from all sorts of serialization.

I am aware of the following set of attributes: ScriptIgnore,JsonIgnore,NonSerialized,IgnoreDataMember,XmlIgnore

Should I put all of them in front of each property of my class that I want to ignore ? It seems bulky.

Is there a sufficient subset of these attributes ?

Is it possible to develop own attribute which would serve as combination of all attributes from that list ?

There are many questions and answers about such attributes, like this one.

But I am looking for universal solution for all serializers or at least most popular of them.

分享给朋友:
您可能感兴趣的文章:
随机阅读: