mercredi 7 octobre 2015

How to Know Static Methods's Class Name

I have a class and it has some static methods. I have also another class inherits my first class like below;

public class A
{
    public static void Do()
    {
    }
}

public class B : A
{
}

I use it like below;

B.Do();

Inside of Do method i try to catch type of B class. I can catch A class Type like below inside of Do method;

public static void Do()
{    
    Type t = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType;
}

But i can't catch the B class name. How can i do that?





Aucun commentaire:

Enregistrer un commentaire