Hi,
I've run into a really interesting runtime bug which generates a rogue stack overflow.
I've defined a structure as follows:
public enum EnumDataType { Raspberry, Orange, Pear, Apple };
public class DataRequest
{
public long DataSize
{
get { return 0; }
set { DataSize = value; }
}
public EnumDataType DataType
{
get { return EnumDataType.Apple; }
set { DataType = value; }
}
}
The following lines work perfectly:
DataRequest request = new DataRequest();
request.DataSize = 60;
However, when I step over the following line in code, it generates a stack overflow:
request.DataType = EnumDataType.Raspberry;
Of course, I can fix it by removing the defaults, or using auto get/set, but I need it to be both readable and writable, and return a default - any ideas?