Yes, it will be interned like any other string literal.
This can be demonstrated with this TryRoslyn example , where it is:
public void M() { Console.WriteLine(nameof(M)); }
Runs in this IL:
.method public hidebysig instance void M () cil managed {
You can see that "M" loads with ldstr , which means it is interned:
"The common language infrastructure (CLI) ensures that the result of two ldstr commands related to two metadata tokens that have the same sequence of characters returns exactly the same string object (a process known as" string interning ").
From Field OpCodes.Ldstr
This can also be verified by running this example, which prints true :
Console.WriteLine(ReferenceEquals(nameof(Main), nameof(Main)));
source share