WCF

WCF Examples

WCF

WCF Projects

WCF Project

adplus-dvertising
Data Contract Enumerations
Previous Home Next

Enumerations are always serializable by definition. When you explain a new enum, there is no need to apply the DataContract attribute on it, and you can freely use it in a data contract

Using an enum in a data contract

enum ContactType
{
   EName,
   EmpPost,
   EmpAddress
}
[DataContract]
struct Contact
{
   [DataMember]
   public ContactType ContactType;
   [DataMember]
   public string FName;
   [DataMember]
   public string LName;
}
Previous Home Next