Using 'nameof' operator instead of magic strings
This commit is contained in:
parent
cef0971d3e
commit
54fc775b24
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
{
|
||||
if (activeParser != codeParser && activeParser != markupParser)
|
||||
{
|
||||
throw new ArgumentException(RazorResources.ActiveParser_Must_Be_Code_Or_Markup_Parser, "activeParser");
|
||||
throw new ArgumentException(RazorResources.ActiveParser_Must_Be_Code_Or_Markup_Parser, nameof(activeParser));
|
||||
}
|
||||
|
||||
CaptureOwnerTask();
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Razor
|
|||
{
|
||||
if (string.IsNullOrEmpty(sourceFileName))
|
||||
{
|
||||
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "sourceFileName");
|
||||
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, nameof(sourceFileName));
|
||||
}
|
||||
|
||||
Host = host;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Razor.Text
|
|||
var line = FindLine(absoluteIndex);
|
||||
if (line == null)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("absoluteIndex");
|
||||
throw new ArgumentOutOfRangeException(nameof(absoluteIndex));
|
||||
}
|
||||
var idx = absoluteIndex - line.Start;
|
||||
return new CharacterReference(line.Content[idx], new SourceLocation(absoluteIndex, line.Index, idx));
|
||||
|
|
|
|||
|
|
@ -35,19 +35,19 @@ namespace Microsoft.AspNet.Razor.Text
|
|||
{
|
||||
if (oldPosition < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("oldPosition", CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
throw new ArgumentOutOfRangeException(nameof(oldPosition), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
}
|
||||
if (newPosition < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("newPosition", CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
throw new ArgumentOutOfRangeException(nameof(newPosition), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
}
|
||||
if (oldLength < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("oldLength", CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
throw new ArgumentOutOfRangeException(nameof(oldLength), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
}
|
||||
if (newLength < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("newLength", CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
throw new ArgumentOutOfRangeException(nameof(newLength), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
|
||||
}
|
||||
|
||||
OldPosition = oldPosition;
|
||||
|
|
|
|||
Loading…
Reference in New Issue