How can i define a List as field of struct?
Something like this :
public struct MyStruct
{
public decimal SomeDecimalValue;
public int SomeIntValue;
public List<string> SomeStringList = new List<string> // <<I Mean this one?
}
And then use that string Like this :
Private void UseMyStruct()
{
MyStruct S= new MyStruct();
s.Add("first string");
s.Add("second string");
}
I've tried a few things but they all return errors and don't work.
classinstead ofstruct?s.SomeStringList.Add();NullRef. The OP would have to initialize the list after instantiating the struct.