C# WCF中的契约和生成的WSDL中的getter和setter

C# WCF中的契约和生成的WSDL中的getter和setter,c#,wcf,C#,Wcf,我有点像: [DataContract] class A { [DataMember] public int name { get; set; } } 对于以上版本1。在WSDL中没有类的字段名称 [DataContract] class A { [DataMember] public int name; public int Name { get { return name; } set { nam

我有点像:

[DataContract]
class A 
{

    [DataMember]
    public int name { get; set; }  
}
对于以上版本1。在WSDL中没有类的字段
名称

[DataContract]
class A 
{

    [DataMember]
    public int name;

    public int Name
    {
        get { return name; }
        set { name = value; }
    }
}
在上面的版本2中。我可以在生成的
WSDL
中看到一个字段
Name

我应该做些什么来制作版本1。以这种方式,生成的
WSDL
可以看到字段
name

侧注:在2中<代码>名称应为
私有
。。。。并且
[DataMember]
应该位于
公共int Name
上。在版本1中,对类A使用“public”访问修饰符。