Is it possible to define an alias for a class in .NET?

The name of one of my classes has been changed, and I cannot change it. I have to maintain backward compatibility, and I don't want to write a wrapper with the old name. Is there an easy way to give class 2 names or give it an alias?

Raised from OP comment:

Do not tell me to use the using directive, as this should be done on the consumer side, and I do not want to change projects that use my library.

+3
source share
2 answers

, - (, Resharper), . , , :

, Type Forwarder. ... IIRC, .

, .cs using:

using OldClassName = SomeNameSpace.NewClassName

, .cs , using.

:

public class OldClassName : NewClassName

, , - . ... .

+6

, , - X Y, .

, IL.

0

Source: https://habr.com/ru/post/1789570/


All Articles