Note that there are some explanatory texts on larger screens.

plurals
  1. POClass library with multiple public aliases for a class
    text
    copied!<p>I'm looking for some ideas on how to do this in the most efficient way.</p> <p>I am replacing an old COM library that is used in a large legacy ASP website with a .NET library written in C#. The old library consisted of just two classes. I've rewritten this functionality in just one class in the new library. </p> <p>The old code makes multiple references to both classes in several dozen pages. I've been getting around the name issue by exposing some empty classes that derive from my single master class which performs the functionality of both previous classes and all is well:</p> <pre><code>public class Foo1 : Bar {} public class Foo2 : Bar {} </code></pre> <p>Bar being the master class which performs all functionality and the two empty classes being the names used within the ASP pages that reference this functionality. Declaring these empty classes seems inefficient but it works fine and alleviates the need to touch the existing legacy ASP code.</p> <p>I'd ideally like to do something like this in my library:</p> <pre><code>public using Foo1 = Bar; public using Foo2 = Bar; </code></pre> <p>Obviously this doesn't work but I feel it best describes what I'd like to do. I would like my class to have two public aliases that can be referenced outside it's namespace.</p> <p>I've been doing quite a bit of digging and I have not been able to find a method that will allow me to do this.</p> <p>I've got a couple different solutions however.</p> <ol> <li>Rename all existing class references in the ASP code to be consistent with my new class.</li> <li>Use some empty public class declarations that derive from my new all inclusive class.</li> </ol> <p>Are there any other methods which would be more efficient?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload