How to resolve class name in static method when accessed through inherited class

I think it is easiest to explain with an example.

Let's say I have the following:

public class A
{
    public static string DoWork() { return "working" + <here I want the class name>;}
}

public class B : A{}

Now if I do

A.DoWork();

I want the result "working < full type name of A >".

If I do

B.DoWork();

I want the same thing but with the full type name of B. Is it possible?

I know it is ugly to do something like this, but when working with certain CMS systems and you do want to write something useful you have to bend the rules.

Jon Skeet
people
quotationmark

I want the same thing but with the full type name of B. Is it possible?

No. A call to B.DoWork is actually compiled into IL for a call to A.DoWork directly. There is no indication in the IL that you actually called B.DoWork, so you can't tell that without looking at the original source.

people

See more on this question at Stackoverflow