0
[DataContract]
public class Credentials
{
[DataMember]
public string UserName {get;set;}
public string Password {get;set;}
}
[DataContract]
public class User
{
[DataMember]
public Credentials Credentials {get;set;}
}
在上面的場景中,由於Credentials是用DataMember屬性修飾的,是否有必要使用DataContract修飾Credentials類,並且它是具有DataMember屬性的成員?DataContract屬性層次結構如何工作?