【发布时间】:2018-03-29 13:52:25
【问题描述】:
我有一个名为 APIEntity 的模型类名称。并且有 DataObject[]。DataObject 有 10 个成员现在我想将成员作为值传递。我该怎么做?
这是我的模型:
public class APIEntity
{
public List<int> unitCodes { get; set; }
public DateTime start { get; set; }
public DateTime end { get; set; }
public DataObject[] fields { get; set; }
}
public class DataObject
{
public string unitCode { get; set; }
public string timedate { get; set; }
public string latitude { get; set; }
public string longitude { get; set; }
public string ignition { get; set; }
public string velocity { get; set; }
public string positionerror { get; set; }
public string digitherm5 { get; set; }
public string direction { get; set; }
public string distance { get; set; }
}
我只是想传递值:
var dat = new APIEntity()
{
unitCodes = new List<int>() { 19215 },
start = DateTime.ParseExact("2018-03-12 10:00:00", "yyyy-MM-dd HH:mm:ss", null),
end = DateTime.ParseExact("2018-03-12 11:00:00", "yyyy-MM-dd HH:mm:ss", null),
fields = ?????? // I want to pass the members here...unitcode,timedate,bla bla....
};
【问题讨论】:
-
fields属性的数据类型应该是什么?
标签: c# asp.net .net asp.net-mvc model