1

For instance, if you have something like

class SomeClass
{
    public string SomeFieldName => nameof(SomeField);
    public int SomeField = 3;
}

Will the nameof() call get replaced with the string nameof() would return? In this case, "SomeField".

Thomas F.
  • 766
  • 10
  • 17

1 Answers1

9

Yes. nameof is a language feature, not a CLR feature. It compiles down to a string constant.

Cory Nelson
  • 29,236
  • 5
  • 72
  • 110
  • Thanks! That's what I was looking for. I figured so, but I just wanted to make sure. Will mark as answer once I can. – Thomas F. Aug 26 '15 at 15:18