别名/缩短.NET中的命名空间

有两个名为Image的名称空间。 一个是iTextSharp和另一个WPF System.Windows.Control.Image

现在我要使用完整的参考,即System.Windows.Control.Image a = new ..iTextSharp.text.Image b = new ...

有没有办法对命名空间进行别名,所以我不必编写完整的命名空间。

是的,只需使用:

 using Img = System.Windows.Control.Image; 

在命名空间声明中。

然后,您可以使用Img别名,因为您之前使用的是完全限定名称。

尝试:

 using yourAlias = System.Windows.Control.Image;