Answers for "error CS0176"

C#
1

c# error CS0176

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
Posted by: Guest on March-05-2020
0

CS0176

//i can't really help out with code, but you'll want to put in the name of the type.
//so int, float, string, etc.
//with enums, classes and other things that you name, it'll need to be the precise name of the type
//so what you name the class and not the name of the variable reference
//be sure to check the capitalization
Posted by: Guest on November-24-2020

C# Answers by Framework

Browse Popular Code Answers by Language