public List <Ticker> Load(DateTime beginTime, DateTime endTime) { List <Ticker> tickerList = new List <Ticker>(); int iTime = 0; DateTime dTime = DateTime.MinValue; Decimal high = 0, low = 0, buy = 0, sell = 0, last = 0, volume = 0; using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { if (fs == null || fs.Length < 1) { return(tickerList); } using (BinaryReader binaryReader = new BinaryReader(fs)) { while (true) { try { iTime = binaryReader.ReadInt32(); dTime = UnixTime.FromInt32(iTime); high = binaryReader.ReadDecimal(); low = binaryReader.ReadDecimal(); buy = binaryReader.ReadDecimal(); sell = binaryReader.ReadDecimal(); last = binaryReader.ReadDecimal(); volume = binaryReader.ReadDecimal(); if (dTime > beginTime && dTime <= endTime) { Ticker ticker = new Ticker(); ticker.Time = dTime; ticker.High = high; ticker.Low = low; ticker.Buy = buy; ticker.Sell = sell; ticker.Last = last; ticker.Volume = volume; tickerList.Add(ticker); } } catch (EndOfStreamException ex) { break; } } } } List <Ticker> sortList = (from entry in tickerList orderby entry.Time ascending select entry).ToList(); return(sortList); }