C# 呼び出し元のファイル名、行数、関数名を取得

ログ出し用に使えますね。.Net4.5から用っぽい

        public void Debug(string mess,
            [System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
            [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
            [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
        {
            string output = Path.GetFileName(sourceFilePath) + "-" + sourceLineNumber.ToString() + ":" + memberName + ":" + mess;
            logger.Debug(output);
        }