I’d like to write the name of the currently running method to a log. I know I can manually type the name of each method into the string being written to the log but I’d like something more automated and reusable. I assume this can be accomplished using reflection but I don’t know where to start with this.
Any suggestions or code samples? Thanks!
Take a look at System.Diagnostics.StackTrace class
Keep in mind there is a performance cost here. You’ll want to be careful using this in performance sensitive code.