How do I alias a class name in C#, without having to add a line of code to every file that uses the class?

Solution 1:

You can’t. The next best thing you can do is have using declarations in the files that use the class.

For example, you could rewrite the dependent code using an import alias (as a quasi-typedef substitute):

using ColorScheme = The.Fully.Qualified.Namespace.Outlook2007ColorScheme;

Unfortunately this needs to go into every scope/file that uses the name.

I therefore don't know if this is practical in your case.

Solution 2:

You can make an alias for your class by adding this line of code:

using Outlook2007ColorScheme = YourNameSpace.ColorScheme;