Tuesday, September 8, 2015

k__BackingField naming property WCF

For example I have a class as bellow in WCF

[Serializable]
public class Student
{
    public string Code { get; set; }
    public string Name { get; set; }
}


When I use Scvutil.exe to create a class for client. Those properties look like this:

Codek__BackingField
Namek__BackingField


Solution:
In WCF change the class likes bellow:

[DataContract]
public class Student
{
    [DataMember]
    public string Code { get; set; }
    [DataMember]
    public string Name { get; set; }
}