home / software / tips and tricks / Explain 'Nameof' Operator in c# 6.0?

Explain 'Nameof' Operator in c# 6.0?

Updated:  10/18/2017 17:10 PM
Author:  Shiju Mathews

Status:    Resolved.


With the introduction of the nameof operator, the hard-coded string to be specified in our code can be avoided. The nameof operator accepts the name of code elements and returns a string literal of the same element. The parameters that the nameof operator can take can be a class name and all its members like methods, variables and constants and returns the string literal.

The nameof Operator can be useful with multiple scenarios,.

Tags: Explain 'Nameof' Operator in c# 6.0?
Updated on: December 2024