Is it possible to print the class name from within a static function?
e.g ...
public class foo
{
static void printName()
{
// Print the
A (cleaner, IMO) alternative (still slow as hell and I would cringe if I saw this in a production code base):
Console.WriteLine(MethodBase.GetCurrentMethod().DeclaringType);
By the way, if you're doing this for logging, some logging frameworks (such as log4net) have the ability built in. And yes, they warn you in the docs that it's a potential performance nightmare.