編譯器錯誤 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
}
}