Test if a Property is not Null before Returning
<p>I have the following property</p>

<pre><code>public MyType MyProperty {get;set;}
</code></pre>

<p>I want to change this property so that if the value is null, it'll populate the value first, and then return it... but <em>without</em> using a private member variable.</p>

<p>For instance, if I was doing this:</p>

<pre><code>public MyType MyProperty 
{
    get
    {
        if (_myProperty != null)
            return _myProperty
        else
           _myProperty = XYZ;
            return _myProperty;
    }
    set
    {
        _myProperty = value;
    }
}
</code></pre>

<p>is this possible? Or do I need the member variable to get it done?</p>
