编译器错误 CS0572
更新:2007 年 11 月
错误消息
“type”:无法通过表达式引用类型;请尝试改用“path_to_type”
试图通过标识符访问类的成员,这在此情况中是不允许的。
下面的示例生成 CS0572:
// CS0572.cs
using System;
class C
{
public class Inner
{
public static int v = 9;
}
}
class D : C
{
public static void Main()
{
C cValue = new C();
Console.WriteLine(cValue.Inner.v); // CS0572
// try the following line instead
// Console.WriteLine(C.Inner.v);
}
}