Does the ‘mutable’ keyword have any purpose other than allowing a data member to be modified by a const member function?

It allows the differentiation of bitwise const and logical const. Logical const is when an object doesn’t change in a way that is visible through the public interface, like your locking example. Another example would be a class that computes a value the first time it is requested, and caches the result. Since c++11 mutable … Read more

WCF: Exposing readonly DataMember properties without set?

Your “server-side” class won’t be “made available” to the client, really. What happens is this: based on the data contract, the client will create a new separate class from the XML schema of the service. It cannot use the server-side class per se! It will re-create a new class from the XML schema definition, but … Read more

When to use DataContract and DataMember attributes?

Since a lot of programmers were overwhelmed with the [DataContract] and [DataMember] attributes, with .NET 3.5 SP1, Microsoft made the data contract serializer handle all classes – even without any of those attributes – much like the old XML serializer. So as of .NET 3.5 SP1, you don’t have to add data contract or data … Read more