Convert nested for-loops into single LINQ statement

后端 未结 5 1124
一生所求
一生所求 2021-02-08 03:23

can someone please help me turn this nested structure into a single LINQ statement?

        EventLog[] logs = EventLog.GetEventLogs();
        for (int i = 0; i          


        
5条回答
  •  忘了有多久
    2021-02-08 03:57

    Try the following:

    from log in logs 
    where log.LogDisplayName.Equals("AAA")
    select 
       (from entry in log.Entries
        where entry.Source.Equals("BBB")
        select entry);
    

提交回复
热议问题