我在某些计算机上遇到了以下查询的性能问题:System.Diagnostics.EventLog log = new System.Diagnostics.EventLog("Application");var entries = log.Entries .Cast<System.Diagnostics.EventLogEntry>() .Where(x => x.EntryType == System.Diagnostics.EventLogEntryType.Error) .OrderByDescending(x => x.TimeGenerated) .Take(cutoff) .Select(x => new { x.Index, x.TimeGenerated, x.EntryType, x.Source, x.InstanceId, x.Message }).ToList();显然ToList()在某些查询中可能会很慢,但是我应该用什么来替换它?
1 回答
- 1 回答
- 0 关注
- 164 浏览
添加回答
举报
0/150
提交
取消