//匿名对象
var list = new List<object>();
list.Add(new {BranchName = "A01", Address = "人民路108号", Tel = "66666666"});
list.Add(new {BranchName = "A02", Address = "天津路888号", Tel = "88888888"});
var result = new { title = '分店地址' list = list};
//非匿名对象
class Branch
{
public string BranchName { get; set; }
public string Address { get; set; }
public string Tel { get; set; }
}
List<Branch> list = new List<Branch>();
list.Add(new Branch() {BranchName = "A01", Address = "人民路108号", Tel = "66666666"});
list.Add(new Branch() {BranchName = "A02", Address = "天津路888号", Tel = "88888888"});
var result = new { title = '分店地址' list = list};
var list = new List<object>();
list.Add(new {BranchName = "A01", Address = "人民路108号", Tel = "66666666"});
list.Add(new {BranchName = "A02", Address = "天津路888号", Tel = "88888888"});
var result = new { title = '分店地址' list = list};
//非匿名对象
class Branch
{
public string BranchName { get; set; }
public string Address { get; set; }
public string Tel { get; set; }
}
List<Branch> list = new List<Branch>();
list.Add(new Branch() {BranchName = "A01", Address = "人民路108号", Tel = "66666666"});
list.Add(new Branch() {BranchName = "A02", Address = "天津路888号", Tel = "88888888"});
var result = new { title = '分店地址' list = list};