WCF and the [DataMember] Attribute
c#, wcf
Solution
Yes, you are right, the MSDN documentation specifies it :
When applied to the member of a type, specifies that the member is part of a data contract and is serializable by the DataContractSerializer.
You should add DataContract attribute to your class to make it serializable :
[DataContract]
public class Sparetime : ChartConfigurationBase, IChartConfiguration
{
}
Note that `FeederOffRate` will be set to its default value (null for reference types).
Problem
I have the following (abbreviated) class that is sent and received to/from the client via WCF: ``` public class Sparetime : ChartConfigurationBase, IChartConfiguration { [DataMember] public int SparetimeConfigurationId { get; set; } public Single FeederOffRate { get; set; } } ``` Notice the first property uses the DataMember attribute and the second doesn't. Am I correct that only the first property would get serialized and sent to the client when a WCF call is made?