我想访问类内列表中的类成员值。我的课是这样的。该类SureViewEvents
包含传入警报的父级详细信息,并且SureViewEventDetails
是警报的详细信息值。我想SureViewEvents
使用 LINQ 遍历类并遍历详细信息行(如果已填充)。
我该怎么做呢?
public class SureViewEvents
{
public string EventId { get; set; }
public string GroupId { get; set; }
public string DateTimeCreated { get; set; }
public string GroupTitle { get; set; }
public string EventTitle { get; set; }
public string SubscriberId { get; set; }
public bool Closed { get; set; }
public List<SureViewEventDetails> Details { get; set; }
}
//EventID|EventRecordID|CreatedDate|EventRecordTypeID|Details|Input1|Input2|EventCode|SubscriberID|EventTitle|SerialNo
public class SureViewEventDetails
{
public string EventId { get; set; }
public string EventRecordID { get; set; }
public string CreateDate { get; set; }
public string EventRecordTypeID { get; set; }
public string Details { get; set; }
public string Area { get; set; }
public string Zone { get; set; }
public string EventCode { get; set; }
public string SubscriberID { get; set; }
public string EventTitle { get; set; }
public int SerialNo { get; set; }
public bool Handled { get; set; }
}
我可以使用以下方法检索父级值,但我不确定如何访问已使用此结构填充的详细信息。任何建议表示赞赏!
var activeEvents = (from sve in m_sureViewEvents
select sve).ToList();
lock (m_driverLock)
{
foreach (var activeEvent in activeEvents)
{
if (activeEvent.Closed == false)
{
m_fepConnector.HandleAlarms();
DownloadZipArchive(activeEvent.EventId);
CloseSureViewEvent(activeEvent.EventId);
}
}
}