📜  c# 错误 CS0176 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:51.261000             🧑  作者: Mango

代码示例1
error CS0176: Member 'Forest.TreeFacts' cannot be accessed with 
    an instance reference; qualify it with a type name instead
    
/*    This usually means that you tried to reference a static 
    member from an instance, instead of from the class                */
    
    
    Forest f = new Forest("Congo", "Tropical");

    Console.WriteLine(f.TreeFacts); //Causes Error
    Console.WriteLine(Forest.TreeFacts); //Fixxes Error