I\'m trying to understand concept \"class\" and write some easy program. But my function Check() is not correct. Please follow me to the right side..
namespa
You're calling Check
as if it was static method. It is instance method so it should called p1.Check()
.
Compiler Error CS0120: An object reference is required for the nonstatic field, method, or property 'member'
So In order to use a non-static field, method, or property, you must first create an object instance of a class
You need to call it with the help of Task
class object
p1.Check();
If you declared Check()
method as static then you can call it as you are currently doing.
public static void Check()
{
if (UserVer == Key)
Console.WriteLine("Good");
}