编译器错误 CS0431

更新:2007 年 11 月

错误消息

别名“identifier”引用的是一个类型,因此不能与“::”一起使用。请改用“.”。

您将“::”与一个引用类型的别名一起使用了。若要解决此错误,请使用“.”运算符。

下面的示例生成 CS0431:

// CS0431.cs
using A = Outer;

public class Outer 
{
   public class Inner 
   {
      public static void Meth() {}
   }
}

public class MyClass
{
   public static void Main()
   {
      A::Inner.Meth();   // CS0431
      A.Inner.Meth();   // OK
   }
}