I am having trouble initializing an array of structs, in which each struct also contains an array of data. I am trying this, but it throws the following compiler error:
A field or property ‘test’ cannot be initialized with a collection object initializer because type ‘test’ does not implement ‘System.Collections.IEnumerable’ interface
struct test
{
int Value1;
int Value2;
int [] Modifiers;
}
test [] Test = new test [ 1 ]
{
new test { 1, 1, new int [5] { 1, 2, 3, 4, 5 } }
};
Could someone please point me in the right direction how to initialize this?