Utilized `nameof()` for `ArgumentNullException`s
Utilized the use of nameof() operator for ArgumentNullExceptions.
This commit is contained in:
parent
98614736a7
commit
955b45f995
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
_location = value;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
_fileContents = value;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
_fileName = value;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
_fileStream = value;
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value",
|
||||
throw new ArgumentNullException(nameof(value),
|
||||
Resources.FormatPropertyOfTypeCannotBeNull(
|
||||
"CookieName", typeof(AntiForgeryOptions)));
|
||||
nameof(CookieName), typeof(AntiForgeryOptions)));
|
||||
}
|
||||
|
||||
_cookieName = value;
|
||||
|
|
@ -61,9 +61,9 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value",
|
||||
throw new ArgumentNullException(nameof(value),
|
||||
Resources.FormatPropertyOfTypeCannotBeNull(
|
||||
"FormFieldName", typeof(AntiForgeryOptions)));
|
||||
nameof(FormFieldName), typeof(AntiForgeryOptions)));
|
||||
}
|
||||
|
||||
_formFieldName = value;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
base.DisplayName = value;
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value",
|
||||
Resources.FormatPropertyOfTypeCannotBeNull("AntiForgeryOptions",
|
||||
throw new ArgumentNullException(nameof(value),
|
||||
Resources.FormatPropertyOfTypeCannotBeNull(nameof(AntiForgeryOptions),
|
||||
typeof(MvcOptions)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
if (routeKey == null)
|
||||
{
|
||||
throw new ArgumentNullException("routeKey");
|
||||
throw new ArgumentNullException(nameof(routeKey));
|
||||
}
|
||||
|
||||
RouteKey = routeKey;
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
_innerDictionary[key] = value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
{
|
||||
if (content == null)
|
||||
{
|
||||
throw new ArgumentNullException("content");
|
||||
throw new ArgumentNullException(nameof(content));
|
||||
}
|
||||
|
||||
Start = start;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Host.Test
|
|||
{
|
||||
if (content == null)
|
||||
{
|
||||
throw new ArgumentNullException("content");
|
||||
throw new ArgumentNullException(nameof(content));
|
||||
}
|
||||
|
||||
Start = start;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.TestCommon
|
|||
{
|
||||
if (testDataProvider == null)
|
||||
{
|
||||
throw new ArgumentNullException("testDataProvider");
|
||||
throw new ArgumentNullException(nameof(testDataProvider));
|
||||
}
|
||||
|
||||
this.testDataProvider = testDataProvider;
|
||||
|
|
|
|||
Loading…
Reference in New Issue