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

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.

Leave a Comment