c# - Console.WriteLine overload not writing all arguments -


and need figure out context issue c# created class overloaded method , want writeline methods. not sure if make sense why here.

i want writeline print out new test.

// class method overload public test(string make, string model, int year, string colour) {     make = make;     model = model;     year = year;     colour = colour; }  // called test mytest = new test("chev", "ava", 2002, "blue"); console.writeline(mytest); 

you have override tostring() in class return correctly formatted string. default implementation of tostring() return name of class.

http://msdn.microsoft.com/en-us/library/ms173154(v=vs.80).aspx

put in class

  public override string tostring()    {      return string.format("{0} {1} {2} {3}",make,model,year,colour);   } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -