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
Post a Comment