Having the following class:
public class SomeClass
{
private readonly int[] _someThings;
public SomeClass()
{
_someThings = new int[4];
}
public int[] SomeThings
{
get { return _someThings; }
}
}
How would I use the object initializer syntax to initialize the SomeThings property like in the following (non-working) code extract?
var anObject = new SomeClass
{
SomeThings[0] = 4,
SomeThings[3] = 8
}
Update
One could do (even without a set property):
anObject.SomeThings[0] = 4;
anObject.SomeThings[3] = 8;
But I'm trying to use the object initializer syntax.