Public static string getmethodinfo () {string STR = ""; // obtain the namespace STR + = "namespace name:" + system. reflection. methodbase. getcurrentmethod (). declaringtype. namespace + "\ n"; // obtain the full name of the current method class STR + = "Class Name:" + system. reflection. methodbase. getcurrentmethod (). declaringtype. fullname + "\ n"; // obtain the current method name STR + = "method name:" + system. reflection. methodbase. getcurrentmethod (). name + "\ n"; STR + = "\ n"; stacktrace Ss = new stacktrace (true); methodbase MB = ss. getframe (1 ). getmethod (); // get 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;} public static void main () {console. writeline (getmethodinfo (); console. readkey ();}