Using 'nameof' operator instead of margic strings
This commit is contained in:
parent
a3c593bda9
commit
1f9a451e2f
|
|
@ -170,11 +170,11 @@ namespace Microsoft.AspNet.Mvc.Routing
|
|||
// would throw.
|
||||
#if DNX451
|
||||
throw new InvalidEnumArgumentException(
|
||||
"item",
|
||||
nameof(item),
|
||||
(int)constraint.KeyHandling,
|
||||
typeof(RouteKeyHandling));
|
||||
#else
|
||||
throw new ArgumentOutOfRangeException("item");
|
||||
throw new ArgumentOutOfRangeException(nameof(item));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (bitLength < 32 || bitLength % 8 != 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bitLength");
|
||||
throw new ArgumentOutOfRangeException(nameof(bitLength));
|
||||
}
|
||||
if (data == null || data.Length != bitLength / 8)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("data");
|
||||
throw new ArgumentOutOfRangeException(nameof(data));
|
||||
}
|
||||
|
||||
_data = data;
|
||||
|
|
|
|||
|
|
@ -1744,7 +1744,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
{
|
||||
if (value < DateOfBirth)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Date of death can't be before date of birth.");
|
||||
throw new ArgumentOutOfRangeException(nameof(value), "Date of death can't be before date of birth.");
|
||||
}
|
||||
_dateOfDeath = value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue