[Solved] Why would this simple code cause a stack overflow exception?


set { TimeZone = value; }

The setter is recursive.

You must use a field like:

string _timeZone;

public string TimeZone
{
    get
    {
        if (_timeZone== null)
            return "";

        return _timeZone;
    }
    set { _timeZone= value; }
}

1

solved Why would this simple code cause a stack overflow exception?