creating a class in C#, use of unassigned variable -


i recieve "use of unassigned varable in infopeople". not sure why, class set example in textbook. shed little light on this. thanks.

  class personinfo     {         public string fname;         public string lname;         public int personid;     }     class program     {         static void main(string[] args)         {             personinfo infopeople;             infopeople.fname = "jeff";             console.writeline("the fname is: " + " " + infopeople.fname);         }     } 

you haven't initialised instance:

personinfo infopeople = new personinfo(); 

i try , conform c# style type/casing conventions:

personinfo infopeople = new personinfo(); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -