private static void ProcessFindCommand(FindCommand command, IIndexingService service) { Console.WriteLine("Start searching..."); IEnumerable<string> fileNames = null; var word = command.Word; var stopwatch = new Stopwatch(); try { stopwatch.Start(); fileNames = service.GetFilesByIndex(new Index(word)); } catch (ArgumentException ex) { Console.WriteLine("Some problems with index"); Console.WriteLine(ex.Message); } stopwatch.Stop(); if ((fileNames != null) && (fileNames.Any())) { Console.WriteLine("I've found files with word: " + word); foreach (var fileName in fileNames) { Console.WriteLine(fileName); } } else { Console.WriteLine("I haven't found anything"); } Console.WriteLine("Done for : " + stopwatch.Elapsed); Console.WriteLine("Stop searching"); }