나는 빠른 질문을했다. select 문에서이 모든 논리를 수행 할 수 있습니까?Linq IEnumerable 선택 질문 - 내 선택 내에서이 모든 작업을 수행 할 수 있습니까?
var entries = atisDAO.GetPME(xl, null);
response.Data.Detectors = new List<DetectorDetails>(entries.Select(pme => new DetectorDetails {ID = pme.PlaceNum.ToString()}));
if(response.Data.Detectors.Any())
{
response.Data.Detectors.ForEach(d =>{
int id;
if(int.TryParse(d.ID, out id))
{
var summaries = atisDAO.GetSummaryEntries(id);
if (summaries.Any())
{
var count = summaries.Sum(summary => summary.TODCount + summary.BFICount + summary.ViolationCount);
var detectionDate = summaries.Max(summary => summary.ReadDate);
d.Count = count.ToString();
d.DetectionTime = new DateTimeZone {
ReadDate = detectionDate.ToString(DATE_FORMAT)
, ReadTime = detectionDate.ToString(TIME_FORMAT)
};
}
}
});
}
선택을 수행 한 다음 목록을 반복하고 방금 선택한 항목을 수정하는 것이 잘못되었습니다. select 문에서이 모든 작업을 수행 할 수 있습니까?
모든 정보 주셔서 감사합니다.
건배, 샌디에고
가 ~ CK
올바른 구문을 가져올 수 없습니다. Visual Studio는 계속 짖고 있습니다. – Hcabnettek