Actually I doubt that. Haven't read the specifics, but for me that sounds like a compile time feature.
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.
> a compile time feature. C# already has a ton of those, the most prominent so far are extension methods.
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
Did you document that somewhere? I might be interested to share that internally. We're C# shop, but quite a number of my coworkers aren't exactly up to speed and a "Let's talk about 3.5 and upwards" session is planned in a couple of weeks..
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.