現在実行しているメソッドを取得

C#で現在実行しているメソッドを取得するプロパティを作ってみました。
何かと役に立ちそう。
インライン化されないようにMethodImpl(MethodImplOptions.NoInlining)を指定するのがポイントです。

public static class Current {
    public static MethodBase Method {
        [MethodImpl(MethodImplOptions.NoInlining)]
        get {
            var stackFrame = new StackFrame(1);
            return stackFrame.GetMethod();
        }
    }
}