c# - Does this code defer retrieval of the event logs until they've been queried? -


where log object of type eventlog, code...

log.entries.cast<eventlogentry>().where(x => x.timegenerated == mydate).tolist();

...somehow query (my where lambda) prior retrieving of logs performs better? (similarly how ef db query) or first pull entire log memory , filter there?

if latter, 'best' (i.e. fast, , more 'performant') use this approach instead (i.e. pass in xml , let query lifting)?

i may have worded little awkwardly, i'm asking if first approach mentioned inefficient querying.

no not perform better, because log.entries implement simple ienumerable, not iqueryable (like ef example). means not analyze "where" clause expression tree , not convert somehow event query before enumeration. query same as:

var result = new list<eventlogentry>(); foreach (eventlogentry x in log.entries) {     if (x.timegenerated == mydate) {         result.add(x);     } } return result; 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -