Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Easier way to have a dictionary of dictionarys like typedefs

Avatar of MickyMc
MickyMcFlag for Ireland asked on
.NET ProgrammingC#
13 Comments1 Solution430 ViewsLast Modified:
AAAAHHAHAHAHHHAHHAHHH  ok sorry but this should be simple...

I have a sorted Dictionary with the key as string and a class like below
          SortedDictionary<String, MyClass>
Now I want to add a manager class so I can have a collection of these sorted dictionaries.. like so    SortedDictionary<String, SortedDictionary<String, MyClass>>

So in my manager class I want to return the Dictionary of Dictionares so I might have a method called GetManager.. like so... SortedDictionary<String, SortedDictionary<String, MyClass>> GetManager()
However to the outside world this is meaningless. I want to typedef this as you would in C++ but you can only do that with the Using clause and it has to be in each file. I also read some where to wrap it up in a class but it did say it was bad practice.. so I,'m only getting into C# and dont want bad practices.

So please tell me how do other developers over come this so that i have something like
 SortedDictionary<String, SortedDictionary<String, MyClass>> ClassManager;
ClassManager GetManager() {...}  

or better still

SortedDictionary<String, MyClass> MyClassCollection;
SortedDictionary<String, MyClassCollection> ClassManager;
ClassManager GetManager() {...}  

I was even thing of having my ClassManager class inherit from  SortedDictionary<String, SortedDictionary<String, MyClass>> but didnt know if this was possible or bad practive also.

Thanks M
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd GerbertFlag of United States of America imageSenior Engineer
Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answers