C# already has a ton of those, the most prominent so far are extension methods.
Foo.Blergh()
can be implemented by a class that offers
static void Blergh(this Foo foo) {}
and the compiler will just replace the call above, looking like a specific thing Foo can do with
SupportingClass.Blergh(thatFooInstance)
I'd say the nameof() implementation is most likely similar and will just replace the name of the local symbol with the symbol itself, during the compilation.
Yes, nameof is compile-time. Similarly, the ?. generates code (a "? :" or if statement) and so does the string interpolation (a call to string.Format).
I've even sketched an outline of a talk of the c# language features that are "just" sugar. e.g. walking through a statement like
var evens = numbers.Where(x => x % 2 == 0);
and showing what it looks like without the compile-time sugar features like the lambda, extension method use of "Where", "var" inference, etc.Of interest I suppose to just-beyond-beginner devs
I highly recommend reading through https://roslyn.codeplex.com/discussions/570551 and the other four revisions of the nameof() spec, they do a very good job at explaining the tradeoffs of each design.