Dictionary<string, int> myDictionary = new Dictionary<string, int>();
is created inside background event _DoWork and returned like so:
e.Result = myDictionary;
now inside my _RunWorkerCompleted event I want to loop though result like so:
foreach (KeyValuePair<string, int> kvp in e.Result)
{
...
}
but I keep getting
Error CS1579 foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public instance or extension definition for 'GetEnumerator'
Why is that? I can loop it inside DoWork event but not when I pass it to RunWorkerCompleted