Imagine I have have a struct with 9 properties, which return a value type as its result and in that struct I also have a property which returns a reference type : IEnumerable
like this:
public IEnumerable<KeyValuePair<String, String>> Dostuff
{
get
{
//doing some operations in here
return _valueToReturn;
}
}
Using IEnumerable
will require heap space, but actually the struct is based on the stack, so what to do in my case?
By the way the struct is immutable.