Automatic Property Value Not Updated with Struct
<p>Take the following <code>struct</code> class:</p>

<pre><code>public struct SingleWraper
{
    private double _myValue;

    public double MyValue
    {
        get { return _myValue; }
        set { _myValue = value; }
    }

    public void SetMyValue(double myValue)
    {
        _myValue = myValue;
    }
}

public struct DoubleWraper
{
    public SingleWraper SingWraper { get; set; }

    public void SetMyValue(double singleVa)
    {
        SingWraper.SetMyValue(singleVa);
    }
}
</code></pre>

<p>Run the following test:</p>

<pre><code>    [Test]
    public void SetMyValue()
    {
        var singleWraper = new DoubleWraper();
        singleWraper.SetMyValue(10);
        Assert.AreEqual(10,singleWraper.SingWraper.MyValue);
    }
</code></pre>

<p>It fails.</p>

<p>However, if you <strong><em>don't</em></strong> use automatic property for <code>DoubleWraper</code>, i.e, you expand the field as below:</p>

<pre><code>public struct DoubleWraper
{
    private SingleWraper _singWraper;
    public SingleWraper SingWraper
    {
        get { return _singWraper; }
        set { _singWraper = value; }
    }

    public void SetMyValue(double singleVa)
    {
        _singWraper.SetMyValue(singleVa);
    }
}
</code></pre>

<p>Then the test will pass.</p>

<p>Why this is so?</p>
