I have the following code running as it should (albeit not special), but I'm trying to make the number of columns defined to be variable. Ideally, this would be done right here in the class. Is something like this possible? I'm using 4.8
public partial class Form1 : Form
{
class NodeN
{
public string NameN { get; set; }
public string Column1 { get; set; }
public string Column2 { get; set; }
public NodeN(string name,string Col1, string Col2)
{
this.NameN = name;
this.Column1 = Col1;
this.Column2 = Col2;
}
}
public Form1()
{
InitializeComponent();
//startup stuff
}
}
What I'd like to do:
public partial class Form1 : Form
{
public class NodeN
{
public string NameN { get; set; }
for (int i = 0; i <= numberofcolumns; i++)
{
//create i column definitions
}
public NodeN(string name, ???? )
{
this.NameN = name;
????
}
}
public int numberofcolumns
public Form1()
{
InitializeComponent();
numberofcolumns = 4
}
}