I am creating a construct from my own class:
namespace testproject
{
public class frameSructure
{
public string type = "n/a";
public string reader = "n/a";
}
}
When I am using it in a form as a single construct everything is fine but when I am creating as an array, When I try to use it:
namespace testproject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public frameSructure[] frame = new frameSructure[10];
private void Form1_Load(object sender, EventArgs e)
{
frame[1].type = "n/a";
}
}
}
I get a system null reference exception. {"Object reference not set to an instance of an object."} at
frame[1].type = "n/a";
Can someone help me understand why? Thank you