Hi NG,
is it possible for struct to have a fixed-length array of primitive
types as member variable as in C++, such that the array doesn't need
to be allocated explicitly?
Eg.:
--------
public const int MAX_VALUES = 4;
public struct Weight
{
int indexes[MAX_VALUES];
float weights[MAX_VALUES];
}
Weight[] weights = new Weight[10];
// Access the array
for(int i = 0; i < MAX_VALUES; i++)
weights[0].indexes[i] = -1;
--------
Rather than:
Weight[] weights = new Weight[10];
foreach(Weight w in weights)
w.indexes = new int[MAX_VALUES];
... and so on ...
// Access the array
The latter is very cumbersome method in my opinion.