取當前方法或函式的名稱
此篇文章引用自   Get Caller Name    [.NET]CallerMemberNameAttribute-可讓您取得方法呼叫端的方法或屬性名稱   C#]CallerMemberName取得呼叫端函式名稱   MSDN - Caller Information (C# and Visual Basic)   Get Current Name   How to get the name of the current method from code  如何取得被呼叫函式的函式名稱   引言   C#不像C++中有一些預先定義的巨集(Predefined Marcors)可以使用   例如常用在輸出Trace Log的:   __FUNCTION__ - 目前原始程式檔名稱   __LINE__ - 目前原始程式檔中行號  在C#當中就沒有提供 (註: .NET中有提供 MethodBase.GetCurrentMethod可以Runtime取得函式名)   解法一: System.Runtime.CompilerServices   從.NET 4.5起在 System.Runtime.CompilerServices  有提供一些類似的功能   CallerFilePathAttribute - 取得呼叫端的程式檔名稱  CallerMemberNameAttribute - 取得呼叫端的函式名稱  CallerLineNumberAttribute - 取得呼叫端的程式檔中的行號     只要在Method中設定 CallerMemberNameAttribute (要using System.Runtime.CompilerServices;),就可以在Method中取得呼叫端資訊,如下為MSDN的範例,    //using System.Runtime.CompilerServices;  namespace  ConsoleApplication1 {     class  Program     {         static  void  Main ( string [] args)          {             TraceMessage( "Hi, Rainmaker!" );      ...