kara yel

kara yel

  • NA
  • 2
  • 0

c# how is "create array class from class that has array variable"?

Apr 7 2009 4:43 PM

hi i wrote a code i c# and i create stuct array from struct that has a array but i have a error on Visual Studio.

my code:

public class o {

public int[] a = new int[5];

public int[] b = new int[5];

public int[] c = new int[5];

}

public class b {

public o[] yy = new o[5];

}

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

b[] oo = new b[5];

oo[0].yy[0].a[1] = 4;

}

}

 

i have error:

Object reference not set to an instance of an object.

 

how i can solution this problem ?

best regard.

 


Answers (1)