Parameterless constructor in struct
Then public
MyStruct[] myStruct = new MyStruct[100]; should call the MyStruct() constructor 100 times.How can I do this?
public struct MyStruct
{
public int id;
static int count = 0;
public MyStruct() //Not allowed?
{
id = count++;
}
}MyStruct[] myStruct = new MyStruct[100];