我正在使用 WCF 和 JSON 构建一个(希望如此)RESTful 服务。
例如:
[DataContract]
public class Person
{
// This member is serialized.
[DataMember]
internal string FullName;
// This is serialized even though it is private.
[DataMember]
private int Age;
// This is not serialized because the DataMemberAttribute
// has not been applied.
private string MailingAddress;
// This is not serialized, but the property is.
private string telephoneNumberValue;
[DataMember]
public string TelephoneNumber
{
get { return telephoneNumberValue; }
set { telephoneNumberValue = value; }
}
}
我需要从 WCF 方法返回一个没有电话号码的 Person 对象(即仅带 FullName 和 Age),所以我想知道是否可以仅使用 Person 类和 WFC 方法的属性属性来完成它?
谢谢
五。