What is the purpose of nameof?

Version 6.0 got a new feature of nameof, but I can’t understand the purpose of it, as it just takes the variable name and changes it to a string on compilation.

I thought it might have some purpose when using <T> but when I try to nameof(T) it just prints me a T instead of the used type.

Any idea on the purpose?

17 Answers
17

Leave a Comment