1
我試圖在JSON NET DeserializeObject過程中設置類屬性設置電子郵件值是大寫的,但它不是從構造
在這裏工作是我的代碼:如何設置類屬性,而DeserializeObject在JsonNet在C#
//賬戶類
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public Account()
{
Email = Email.ToUpper();
}
}
////按鈕點擊事件
string json = @"{
'Email': '[email protected]',
'Active': true,
'CreatedDate': '2013-01-20T00:00:00Z'
}";
Account account = JsonConvert.DeserializeObject<Account>(json);
MessageBox.Show(account.Email);//printed [email protected]