Utilized `nameof()` for `ArgumentNullException`s

Utilized the use of nameof() operator for ArgumentNullExceptions.
This commit is contained in:
Henk Mollema 2015-04-24 17:09:13 +02:00 committed by Kiran Challa
parent 98614736a7
commit 955b45f995
12 changed files with 16 additions and 16 deletions

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException(nameof(value));
} }
_location = value; _location = value;

View File

@ -54,7 +54,7 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException(nameof(value));
} }
_fileContents = value; _fileContents = value;

View File

@ -65,7 +65,7 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException(nameof(value));
} }
_fileName = value; _fileName = value;

View File

@ -58,7 +58,7 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException(nameof(value));
} }
_fileStream = value; _fileStream = value;

View File

@ -38,9 +38,9 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value", throw new ArgumentNullException(nameof(value),
Resources.FormatPropertyOfTypeCannotBeNull( Resources.FormatPropertyOfTypeCannotBeNull(
"CookieName", typeof(AntiForgeryOptions))); nameof(CookieName), typeof(AntiForgeryOptions)));
} }
_cookieName = value; _cookieName = value;
@ -61,9 +61,9 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value", throw new ArgumentNullException(nameof(value),
Resources.FormatPropertyOfTypeCannotBeNull( Resources.FormatPropertyOfTypeCannotBeNull(
"FormFieldName", typeof(AntiForgeryOptions))); nameof(FormFieldName), typeof(AntiForgeryOptions)));
} }
_formFieldName = value; _formFieldName = value;

View File

@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException(nameof(value));
} }
base.DisplayName = value; base.DisplayName = value;

View File

@ -50,8 +50,8 @@ namespace Microsoft.AspNet.Mvc
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value", throw new ArgumentNullException(nameof(value),
Resources.FormatPropertyOfTypeCannotBeNull("AntiForgeryOptions", Resources.FormatPropertyOfTypeCannotBeNull(nameof(AntiForgeryOptions),
typeof(MvcOptions))); typeof(MvcOptions)));
} }

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Mvc
{ {
if (routeKey == null) if (routeKey == null)
{ {
throw new ArgumentNullException("routeKey"); throw new ArgumentNullException(nameof(routeKey));
} }
RouteKey = routeKey; RouteKey = routeKey;

View File

@ -163,7 +163,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{ {
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException(nameof(value));
} }
_innerDictionary[key] = value; _innerDictionary[key] = value;
} }

View File

@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Mvc.Razor
{ {
if (content == null) if (content == null)
{ {
throw new ArgumentNullException("content"); throw new ArgumentNullException(nameof(content));
} }
Start = start; Start = start;

View File

@ -193,7 +193,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Host.Test
{ {
if (content == null) if (content == null)
{ {
throw new ArgumentNullException("content"); throw new ArgumentNullException(nameof(content));
} }
Start = start; Start = start;

View File

@ -17,7 +17,7 @@ namespace Microsoft.TestCommon
{ {
if (testDataProvider == null) if (testDataProvider == null)
{ {
throw new ArgumentNullException("testDataProvider"); throw new ArgumentNullException(nameof(testDataProvider));
} }
this.testDataProvider = testDataProvider; this.testDataProvider = testDataProvider;