Consider the following code:
class A
{
public void Foo()
{
string thisFunction = // get the name of the executing function (Foo)
string thisType = // get the name of the object type (A)
Log.PrintLog(thisFunction, thisType);
}
}
public static class Log
{
public static void PrintLog(string function, string type)
{
Console.WriteLine("Call from function {0}, type {1}", function, type);
}
}
How can I find name of the executing function and object type? Any other solution except using [CallerFilePath] and [CallerMemberName]?