forked from ahotko/c-sharp-code-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CallerInfoSample.cs
25 lines (23 loc) · 892 Bytes
/
CallerInfoSample.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
namespace CodeSamples.Classes
{
public class CallerInfoSample : SampleExecute
{
public void TraceMessage(string message,
[System.Runtime.CompilerServices.CallerMemberName] string memberName = "",
[System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "",
[System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
Console.WriteLine($"Message = {message}");
Console.WriteLine($"Member (Method) Name = {memberName}");
Console.WriteLine($"Source File Path = {sourceFilePath}");
Console.WriteLine($"Line Number = {sourceLineNumber}");
}
public override void Execute()
{
Title("CallerInfoSampleExecute");
TraceMessage("Tracing this call...");
Finish();
}
}
}