I am currently banging my head against a wall as to what is the best solution for the following problem. Any help/advice you can provide me with will be greatly appreciated.
I have an application which will contains two collections of objects. People and Companies. I wish to maintain a list of all the companies and all the people in memory at any one time (for performance reasons - duplication is not an issue).
I want to be able to loop through the people collection in two ways. By Person and By Company.
If I want to populate a list with all people I can simply loop through the single people collection. If however I want to loop through all the people associated with a company I have to loop through every person, check if they belong to a company and display them. I would prefer to have a seperate company employees collection in the company class but doing this means duplicating objects over and over.
Can anybody help me untangle this mess in my brain.
Cheers
I have an application which will contains two collections of objects. People and Companies. I wish to maintain a list of all the companies and all the people in memory at any one time (for performance reasons - duplication is not an issue).
I want to be able to loop through the people collection in two ways. By Person and By Company.
If I want to populate a list with all people I can simply loop through the single people collection. If however I want to loop through all the people associated with a company I have to loop through every person, check if they belong to a company and display them. I would prefer to have a seperate company employees collection in the company class but doing this means duplicating objects over and over.
Can anybody help me untangle this mess in my brain.
Cheers