I have a class that I pass as a result of a service method, and this class has a get-only property:
[DataContract] public class ErrorBase { [DataMember] public virtual string Message { get { return ""; } } }
I get an exception from the service side:
System.Runtime.Serialization.InvalidDataContractException: The method for the "Message" property of type "MyNamespace.ErrorBase" has not been set.
I should only have this property as a getter, I cannot allow users to assign a value to it. Any workaround I could use? Or am I missing an additional attribute?
c # properties wcf datacontractserializer
Andrey Feb 24 '10 at 2:29 2010-02-24 02:29
source share