How to find the name of the parent class, within a base class in C#?
<p>I inherit a class from a base class "MyLog". </p>

<p>If I call "Write" within the inherited class, I want it to prefix any messages with the name of the inherited class.</p>

<p>As this application needs to be fast, I need some way of avoiding reflection during normal program operation (reflection during startup is fine).</p>

<p>Here is some code to illustrate the point:</p>

<pre><code>class MyClassA : MyLog
{
   w("MyMessage"); // Prints "MyClassA: MyMessage"
}

class MyClassB : MyLog
{
   w("MyMessage"); // Prints "MyClassB: MyMessage"
}

class MyLog
{
  string nameOfInheritedClass;
  MyLog()
  {
    nameOfInheritedClass = ?????????????
  }

  w(string message)
  {       
     Console.Write(nameOfInheritedClass, message);
  }
}
</code></pre>
