public IReadOnlyCollection <ScanResult> GetResult() { HashSet <ScanResult> results = new HashSet <ScanResult>(); foreach (IScanner scanner in _scanners) { IEnumerable <long> previousResultsHashes = results.SelectMany(res => res.LineHashes); var scannerResultsToAdd = scanner.GetResult() .Where(scan => scan.IsSuccess && !previousResultsHashes.Any(hash => scan.LineHashes.Contains(hash))); foreach (ScanResult scannerResult in scannerResultsToAdd) { results.Add(scannerResult); } } ScanResult[] result = results.Any() ? results.ToArray() : new[] { ScanResult.Failure() }; return(result); }
public IReadOnlyCollection <ScanResult> GetResult() { return(_results.Any() ? _results.ToArray() : new[] { ScanResult.Failure() }); }