Skip to main content

RCS1015: Use nameof operator

Properties

PropertyValue
Default SeverityInfo
Minimum language version6.0

Examples

Example #1

diagnostic.cs
public void Foo(object parameter)
{
if (parameter == null)
{
throw new ArgumentNullException("parameter", "message");
}
}
fix.cs
public void Foo(object parameter)
{
if (parameter == null)
{
throw new ArgumentNullException(nameof(parameter), "message");
}
}

Applies to