Course Solutions Uncategorized (Solved) : C Won T Following Work Get Error Object Reference Required Non Static Field Method Propert Q28779986 . . . .

(Solved) : C Won T Following Work Get Error Object Reference Required Non Static Field Method Propert Q28779986 . . . .

 

In C#, why won’t the following work? I get an error: “An objectreference is required for the non-static field, method, orproperty”.

public void StudentNames(string student)

{
   Console.WriteLine($”{student}”);
}

static void Main(string[] args)
        {
           string student = “John Doe”;
           string whatever = StudentNames(student);

                // some other code
         }

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post