由网友(只剩一个角落的繁华,)分享简介:我继承了一些类有大量的属性。我希望能够连载他们 WCF 。I inherited some classes with a large number of attributes. I want to be able to serialize them for WCF.由于的DataContractSerializer...
我继承了一些类有大量的属性。我希望能够连载他们 WCF
。
I inherited some classes with a large number of attributes. I want to be able to serialize them for WCF
.
由于的DataContractSerializer
是一个选择序列化,我将需要装饰的所有属性与数据成员
属性,这在我看来有点麻烦。难道我周围有任何其他方式,这样我就不用加数据成员
所有属性?
As DataContractSerializer
is an opt-in serializer, I will need to decorate all the properties with DataMember
attribute, which seems to me a little cumbersome. Don't I have any other way around so that I don't have to add DataMember
to all the properties?
请注意,我的大部分属性需要被序列化。
Please note, most of my properties need to be serialized.
推荐答案
从 DOTNET 4.0 以上,
您可以避开 [DataContract]
属性,以使所有的公开
数据成员序列化
。
You can avoid the [DataContract]
attribute to make all the public
datamembers serializable
.
相关推荐
最新文章