I have a class which has a method that receives a variable:
class MyClass
{
    void ReceiveVariable(object someVariable)
    {
       //wanna get the type of the class that is declaring someVariable here
    }
}
I know this variable is a field from another class(which I don't know of), such as:
class DontKnowThisType
{
    public object someVariable;
}
How can I get the type of the class that is declaring someVariable(in this case DontKnowThisType) in my method ReceiveVariable?
 
Aucun commentaire:
Enregistrer un commentaire