-6

I have a constructor that takes 2 arguments although I don't know how to write it.

// Home.CS:
var menu = new menu (dt.Rows[0][0].Tostring());

I don't know how to write the second argument in the code above

// Menu.cs
public Menu (string role, string Millitary)
initializeComponet();
Label1.Text = Role;
Label2.Text = Millitary;
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325

2 Answers2

0

If second argument is not required then you can pass any value as

var menu = new Menu (dt.Rows[0][0].Tostring(),string.Empty);

Or if the value of both is to be same then pass same parameter twice as you mentioned in comment

var menu = new Menu (dt.Rows[0][0].Tostring(),dt.Rows[0][0].Tostring());
M.S.
  • 4,283
  • 1
  • 19
  • 42
0

In side the () so if only one was required it would be (FirstArgument) if 2 are required its (FirstArgument , SecondArgument) etc. using a "," as the seperator