I have an array of objects, and am trying to populate a worksheet using ImportCustomObjects. Each object contains a nested object with its own properties. How can I reference the properties in the nested objects? I have tried variations on dot and # notation, with no success.
myWorksheet.Cells.ImportCustomObjects(items, new string[] { "FriendlyName", "Address",
"TestData.TestedDate", "TestData.ResultString", "TestData.Message" },
true, 0, 0, items.Count, true, "MM/dd/yyyy HH:mm:ss", false);
public class MyNestedClass
{
public string ResultString{ get; set; }
public string Message{ get; set; }
public DateTime TestedDate { get; set; }
}
public class MyClass
{
public string FriendlyName { get; set; }
public string Address { get; set; }
public string Field3 { get; set; }
public string Field4 { get; set; }
public MyNestedClass TestData { get; set; }
}