C#
public class DataModel
{
public string id { get; set; }
public string Name { get; set; }
}
public void setTest()
{
//一般宣告
DataModel Test1 = new DataModel();
Test1.id = "1";
Test1.Name = "我是誰";
//宣告Model直接給資料
DataModel Test2 = new DataModel()
{
id = "1",
Name = "我是誰"
};
//以上解果相同
}
我只是一棵樹