Anton Nijus

Anton Nijus

  • NA
  • 25
  • 1.6k

How to Pass Array Model as a value?

Mar 29 2018 8:41 AM
This is my model:
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; }
}
I am just trying to pass the values:
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....
};

Answers (1)