Is there any elegant way to execute specific code depending on the caller, using reflection or otherwise?
<p>In my ideal world, what I'm looking for would exist as something along the lines of this:</p>

<pre><code>public string UserDefinedField
{
    get { return _userDefinedField; }
    internal set { _userDefinedField = value; }        
    set { _userDefinedField = value; ChangedFields.Add(Fields.UserDefinedField); }
}
</code></pre>

<p>Where one statement is executed regardless of the access modifier, and another statement is executed if it's called from an external assembly or class.</p>

<p>I'm sure I could code something by using reflection and checking up the current call stack to see if the caller is in the same assembly, but I'm looking to see if there's a more elegant approach than that.</p>
