[DataContract]
[Serializable]
public class WSAccount
{
[DataMember]
public string AccountNumber { get; set; }
[DataMember]
public string Pin { get; set; }
}
[DataContract]
[Serializable]
public class WSUser
{
[DataMember]
public WSAccount wsAccount { get; set; }
[DataMember]
public bool IsValidUser { get; set; }
}
実行中にエラーが発生する
WSUser user = new WSUser();
user.wsAccount.AccountNumber = userNameresponse.account.ID;
しかし、
WSUser user = new WSUser();
user.wsAccount = new WSAccount();
user.wsAccount.AccountNumber = userNameresponse.account.ID;
子クラスWSAccountをインスタンス化する必要がありますか?