Dictionary<Calculation, List<PropertyValue>> result = new Dictionary<Calculation, List<PropertyValue>>();
while (reader != null && reader.Read()) //it loops about 60000, and it will be bigger
{
#region create calc and propvalue variables
//...
#endregion
//this FirstOrDefault needs a lot of time
tmpElementOfResult = result.Keys.FirstOrDefault(r => r.InnerID == calc.InnerID);
if (tmpElementOfResult == null)
{
result.Add(calc, new List<PropertyValue> { propValue });
}
else
{
result[tmpElementOfResult].Add(propValue);
}
}
你能給我一些想法如何使它更快,因爲現在它的大約25秒:(
把讀卡器= NULL比較 - 雖然條款之外。現在你正在檢查它約60000 ...當你可以檢查一次。 – Jonathan 2010-08-25 10:09:09
是的,我修復它,這是一個錯誤:)。謝謝! – 2010-08-25 11:16:16