I have a C# class with methods that take and return types that look something like this:
Dictionary<ClassWithLongNameA, Dictionary<ClassWithLongNameB, ClassWithLongNameB.ProtectedStructType> >
or this:
Dictionary<ClassWithLongNameB, ClassWithLongNameB.ProtectedStructType>
That makes for some cumbersome method definitions that are long and hard to read. If this were C++ I would make my code more readable by utilizing a typedef but that's not available in C#.
I'm aware that I could use a using
statement in a manner similar to typedef
in C++ from reading this question, but it doesn't work for me for two reasons:
It only applies to one source file and I need this to work with all of the source files that utilize my class and/or inherit from it
I can't use it if one of the template arguments is a protected or private nested type (as it won't be accessible to the
using
statement) and that is the case for me
I didn't see any other answers in that question that seemed like a good solution to my issue specifically.
What are some other good ways of dealing with this?
edit: This question is not a duplicate of this question as every answer in that thread suggests a using
statement, and I have already explained why that is not an appropriate answer to my question.