No; the compiler hard-codes the member-name directly during compilation. In terms of the IL, this is ldstr
. For example if we compile:
static void Implicit()
{
Log();
}
static void Explicit()
{
Log("Explicit");
}
static void Log([CallerMemberNameAttribute] string name = null)
{}
we get:
.method private hidebysig static void Implicit() cil managed
{
.maxstack 8
L_0000: ldstr "Implicit"
L_0005: call void Program::Log(string)
L_000a: ret
}
.method private hidebysig static void Explicit() cil managed
{
.maxstack 8
L_0000: ldstr "Explicit"
L_0005: call void Program::Log(string)
L_000a: ret
}
As you can see - the IL has the name baked in directly exactly the same as if we put a string in manually.