nameof
The C# operator that turns a symbol into its name as a string, as in nameof(price) giving "price".
In more detail
It is evaluated at compile time, so it costs nothing at run time. Because the compiler checks it, renaming the parameter renames the string too, unlike a hand-typed literal.
Related terms
- ArgumentOutOfRangeException — The .NET exception to throw when an argument's value is outside what a method accepts, such as a negative price.
Taught in
- Records, Pattern Matching, and Modern C# — Modern .NET Core, C# & Enterprise Microservices