I made an IDictionary where each value is a user-defined class called employee, and the key is an integer (the employee's id number). Now, im using such a statement:

for each(employee^ de in globals::clientBase)
{
sr->WriteLine(de->employeeName);
}

but i get an error at runtime saying that they couldnt cast System::Object^ into employee^ which is understandable. but i want to be able to access the members of every value (where the value is of the type employee) and if change that to:

[code=CPP]
for each(DictionaryEntry^ de in globals::clientBase)
{
sr->WriteLine(de->Value->employeeName);
}

then ill get a compile-time error saying that employeeName is not a member of de->Value, so what should i do?

To sum up, i have an IDictionary of employeeType as value and an integer as key, and during a for each traversal of the dictionary i want to be able to access the members of value (i.e employee first name, telephone, etc...)

any ideas??

um for each is not c++ built in keyword. are you using something else or some type of library?

There is this for_each(), but I think you're confused with foreach from another language like C#, PHP, or something.

Wrong section perhaps?