Getter without body, Setter with
<p>I have a property which is currently automatic.</p>

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

<p>However, I now need it to perform some action every time it changes, so I want to add logic to the setter. So I want to do something like:</p>

<pre><code>public string MyProperty {
    get;
    set { PerformSomeAction(); }
}
</code></pre>

<p>However, this doesn't build... <code>MyProperty.get' must declare a body because it is not marked abstract, extern, or partial</code></p>

<p>I can't just have the getter return <code>MyProperty</code> as it will cause an infinite loop.</p>

<p>Is there a way of doing this, or do I have to declare a private variable to refer to? I'd rather not as <code>MyProperty</code> is used through out the code both in this class and outside it </p>