Convert nested for-loops into single LINQ statement
can someone please help me turn this nested structure into a single LINQ statement? EventLog[] logs = EventLog.GetEventLogs(); for (int i = 0; i < logs.Length; i++) { if (logs[i].LogDisplayName.Equals("AAA")) { for (int j = 0; j < logs[i].Entries.Count; j++) { if (logs[i].Entries[j].Source.Equals("BBB")) { remoteAccessLogs.Add(logs[i].Entries[j]); } } } } Nested loops usually end up with multiple "from" clauses (which are converted into calls to SelectMany by the compiler): var remoteAccessLogs = from log in EventLogs.GetEventLogs() where log.LogDisplayName == "AAA" from entry in log.Entries