A student on a course I'm teaching this week asked me how to get hold of the current running method (for logging purposes). I muttered that its possible but a bit of a hack - you have to throw then catch an exception - hey presto! a stack trace.
So anyway I thought I maybe am missing something as I may be able to do what the exception framework does. Very quickly I came upon two excellent classes StackTrace and StackFrame. Well knock me down with a feather! Here was exactly what I was looking for.
By simply creating an instance of the StackFrame class using the default constructor, I can get a snapshot of the current stack frame - fanstastic! and then I can use StackFrame.GetMethod() to get the MethodInfo for the executing method.
Well maybe everyone else already knew this but it was just another example of how much stuff is in the BCL