Harshal Patil

Harshal Patil

  • NA
  • 4
  • 3.6k

List access which stores the number of array.

Jul 29 2015 1:06 PM
for (int i = 0; i < NObjCnt; i++)
{
float[] a = new float[k];
m = 0;
for (int j = 0; j < k; j++)
if (d[i, j] < 0) break;
else
{
a[m] = d[i, j];
m++;
}
int[] b = new int[m - 2];
//Now Define a Brand New Data Struct and Store Info Related to This Current Hit Object
hitObj h = new hitObj();
h.data = new float[m - 2];
for (int j = 1; j < m-1 ; j++) h.data[j - 1] = a[j];
h.Start = a[0] + 1;
h.End = a[m - 1] + 1;
h.name = "Object " + (i + 1);
MyHitObjs.Add(h);
 // print
foreach (hitObj h in MyHitObjs)
{
richTextBox1.Text += "\n\n" + h.name + " [" + h.Start + "," + h.End + "]";
for (int i = 0; i < h.data.Length; i++)
richTextBox1.Text += "\n" + h.data[i];
}
 
 
In this case the h is the struct class  object which hold number of array point which is dynamic. i need to access that array and draw the line for that points? any suggestion              for (int j = 1; j < m-1 ; j++) h.data[j - 1] = a[j]; this will generate set of array.