Source Network:
Public Static String Getmethodinfo ()
{
String STR = "" ;
// Get the namespace of the current method
STR + = " Namespace Name: " + System. reflection. methodbase. getcurrentmethod (). declaringtype. namespace +" \ N " ;
// Obtain the full name of the current method class, including the namespace
STR + = " Class Name: " + System. reflection. methodbase. getcurrentmethod (). declaringtype. fullname + " \ N " ;
// Get the current method name
STR + = " Method Name: " + System. reflection. methodbase. getcurrentmethod (). Name + " \ N " ; STR + = " \ N " ;
System. Diagnostics. stacktrace Ss = New System. Diagnostics. stacktrace ( True );
System. reflection. methodbase MB = ss. getframe ( 1 ). Getmethod ();
// Obtain the namespace of the parent Method
STR + = Mb. declaringtype. namespace + " \ N " ;
// Obtain the parent method class name
STR + = Mb. declaringtype. Name + " \ N " ;
// Obtain the full name of the parent method class.
STR + = Mb. declaringtype. fullname + " \ N " ;
// Obtain the parent method name
STR + = Mb. Name + " \ N " ; Return STR;
}
Package not only the current method, namespace, class name, And Method Name of the current page, but also the namespace, class name, and method name of the parent class.