I know how to get the current method (MethodBase.GetCurrentMethod()).
However, the DeclaringType property of MethodBase will give me the type on which the method is defined.
I am interested in the type of the method on which it was actually called at runtime.
If you mean the type of the object itself then just use
this.GetType()? That will give you the type ofthison which the current method is executing.If you mean the type of the reference on which the method was executed then that’s not really possible to determine. Consider virtual methods as an example.
The reference type could be
Animalbut if the object isLabradorthen that version of theMakeNoisemethod will be invoked. Their is no way from theMakeNoisemethod to know if it’ was invoked from anAnimal,DogorLabradorinstance.