0

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??

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by MosaicFuneral
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.