C# Determining the type of an object
<p>I'm not exactly sure how to ask this question well. Sorry if it's unclear. I'm trying to determine the type an object is acting as, not the actual type of an object.</p>

<p>Say I have these two classes:</p>

<pre><code>public class A{
    public A() {
        string thisTypeName = this.GetType().???; // the value I'm looking for here is "A" not "B"
    }
}

public class B : A { }
</code></pre>

<p>What I do not want is...</p>

<pre><code>string thisTypeName = this.GetType().BaseType.Name;
</code></pre>

<p>...because if I decide to do this...</p>

<pre><code>public class C : B { }
</code></pre>

<p>...then now my this.GetType().BaseType will reference the class B, not A. </p>

<p>Is there a built-in way to do this? I'm guessing I can probably write an extension method on Type that will do what I want.</p>
