protected virtual void ReadRecords <T>(IDictionary <int, T> storage) where T : class, new() { var fieldCache = typeof(T).GetFields().Select(x => new FieldCache <T>(x)).ToArray(); _reader.Enumerate((row) => { T entry = new T(); row.GetFields(fieldCache, entry); lock (storage) storage.Add(row.Id, entry); }); }
private void ReadRecords <T>(IDictionary <int, T> storage) where T : class, new() { var startTime = DateTime.Now; var fieldCache = typeof(T).GetFields().Select(x => new FieldCache <T>(x)).ToArray(); _reader.Enumerate((row) => { var entry = new T(); row.GetFields(fieldCache, entry); lock (storage) storage.Add(row.Id, entry); }); var span = DateTime.Now.Subtract(startTime); Console.WriteLine($"{ FileName.PadRight(33) } { TimeSpan.FromTicks(span.Ticks).ToString().PadRight(28) } { storage.Count.ToString().PadRight(19) }"); }