views:

175

answers:

1

I have the following members defined in a class that I'm trying to deserialise:

[DataMemberAttribute(Name = "cust_title")]
     public String Title { get; set; }
     [DataMemberAttribute(Name = "cust_description")]
     public String Description { get; set; }

For some reason, the deserialisation fails (it seems to ignore the DataMemberAttribute).

Does anyone know how to get this working?

A: 

I've just found the answer out by a bit of trial and error. In order to use the [DataMemberAttribute] you must also put [DataContractAttribute] above your class definition:

[DataContractAttribute]
public class MyClass
{
  [DataMemberAttribute(Name="test_test")]
  public String Test { get; set; }
}
Mark Ingram