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 to serialize into a web service.

1

There are 1 answers

0
tomasr On BEST ANSWER

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).