private Dictionary<DateTime, Dictionary<string, long>> DataByNum; private Dictionary<DateTime, Dictionary<string, long>> DataByID; private Dictionary<string, long> GetNumData(DateTime DailyFileDate) { DailyFileDate = DailyFileDate.Date; if (DataByNum == null || !DataByNum.ContainsKey(DailyFileDate)) { CacheData(DailyFileDate); } return DataByNum[DailyFileDate]; } private Dictionary<string, long> GetIDData(DateTime DailyFileDate) { DailyFileDate = DailyFileDate.Date; if (DataByID == null || !DataByID.ContainsKey(DailyFileDate)) { CacheData(DailyFileDate); } return DataByID[DailyFileDate]; } private void CacheData(DateTime DailyFileDate) { DailyFileDate = DailyFileDate.Date; if (DataByNum == null) { DataByNum = new Dictionary<DateTime, Dictionary<string, long>>(); } if (DataByID == null) { DataByID = new Dictionary<DateTime, Dictionary<string, long>>(); } var result = ExtractData(DailyFileDate); foreach (DataRow row in result) { var date = DateTime.Parse(row.GetString("FileDate")).Date; if (!DataByNum.ContainsKey(date)) { DataByNum[date] = new Dictionary<string, long>(); DataByNum[date].Add(row.GetString("Num"), row.GetLong("RID").Value); } if (!DataByID.ContainsKey(date)) { DataByID[date] = new Dictionary<string, long>(); DataByID[date].Add(row.GetString("CustomerID"), row.GetLong("RID").Value); } }
dictionary.Clear()
new
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)