I'm adding key-values to my hashtable (company_data), but everytime I add something new, it adds it to the element from which the hashtable was derived, Universe[ i ]. Universe is just an arraylist of hastables that is declared as a member of the class. Its creating a reference i'm guessing to the original element instead of copying just the actual values. How do I fix this?
Thanks for the help.
Code:
for(int i=0; i<Convert.ToInt32(Universe.Count*0.1); i++)
{
Hashtable company_data = new Hashtable();
company_data = (Hashtable)Universe[ i ];
Hashtable dm = report.DownloadMnemonics_pri();
foreach(string key in dm.Keys)
{
company_data.Add(key,GetFactSetData(company_data["ticker"].ToString(),dm[key].ToString()));
}
report.Add(company_data);
ReportProgressToClient(i,Convert.ToInt32(Universe.Count*0.1),"FactSet Download: " + company_data["ticker"].ToString(), ProgressType.CURRENT_PROGRESS);
dm = null;
company_data = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
Comment