public class CardModel { public string card_id { get; set; } public Service_Statement service_statement { get; set; } } public class Service_Statement { public string name { get; set; } public string url { get; set; } }
这种应该如何赋值呢?
CardModel card=new CardModel();
card.card_id="123456789";
service_statement这个对象应该怎么赋值?
再来一个 new
card.service_statement = new Service_Statement { name = "cnblogs" };
哦 原来是这样啊?如果这样写对不对?
CardModel card=new CardModel(); card.card_id="123456789";
card.service_statement = new Service_Statement();
card.service_statement.name = "cnblogs"
@大da脸: 这样写也可以
@dudu:
public class Required_Form { public bool can_modify { get; set; } public Rich_Field_List[] rich_field_list { get; set; } public string[] common_field_id_list { get; set; } } public class Rich_Field_List { public string type { get; set; } public string name { get; set; } public string[] values { get; set; } }
最后一个问题 这个Rich_Field_List 应该怎么写赋值
@大da脸:
var form = new Required_Form();
form.rich_field_list = new[] { new Rich_Field_List() };
form.rich_field_list[0].name = "Cnblogs";
@dudu: 非常感谢