Instead of having to specify [DataMember] for every member, is there a sort of attribute that can just assume it is a datamember?
I have a class with a lot of members that I have 开发者_StackOverflow中文版to serialize into a web service.
You could use [Serializable] instead, but it's going to cause you trouble in the future for versioning. Basically giving up [DataMember] means you can't explicitly control serialization order for members of your contract, which means adding a new member can easily break existing clients (because of the default WCF behavior of ordering members in alphabetical order instead of order of declaration).
精彩评论