Z
Zenon
I have a function which returns array of structs. I need to create a
collection of those arrays and thought that an ArrayList would be a
good way to do this since the count is variable. The problem I am
having is that although the arrays are being properly stored in the
ArrayList, I cannot access the individual items in the arrays. For
instance I was hoping to do this:
public struct S
{
public int X;
public string Y;
}
S[] SInstance = new S[17];
SInstance[0].X = 5;
SInstance[0].Y = "foo";
SInstance[1].X = 10;
SInstance[1].Y = "bar";
ArrayList AL = new ArrayList();
AL.add(SInstance[0]);
AL.add(SInstance[1]);
int xx = AL[0].SInstance[0].X;
string yy = AL[0].SInstance[0].Y;
As I step through the code, I can see all of the struct instances in
the array, but I don't know how to access them. Any ideas?
thanks,
collection of those arrays and thought that an ArrayList would be a
good way to do this since the count is variable. The problem I am
having is that although the arrays are being properly stored in the
ArrayList, I cannot access the individual items in the arrays. For
instance I was hoping to do this:
public struct S
{
public int X;
public string Y;
}
S[] SInstance = new S[17];
SInstance[0].X = 5;
SInstance[0].Y = "foo";
SInstance[1].X = 10;
SInstance[1].Y = "bar";
ArrayList AL = new ArrayList();
AL.add(SInstance[0]);
AL.add(SInstance[1]);
int xx = AL[0].SInstance[0].X;
string yy = AL[0].SInstance[0].Y;
As I step through the code, I can see all of the struct instances in
the array, but I don't know how to access them. Any ideas?
thanks,