Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Commit 955b45f

Browse files
henkmollemakichalla
authored andcommitted
Utilized nameof() for ArgumentNullExceptions
Utilized the use of nameof() operator for ArgumentNullExceptions.
1 parent 9861473 commit 955b45f

File tree

12 files changed

+16
-16
lines changed

12 files changed

+16
-16
lines changed

src/Microsoft.AspNet.Mvc.Core/ActionResults/CreatedResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public string Location
4040
{
4141
if (value == null)
4242
{
43-
throw new ArgumentNullException("value");
43+
throw new ArgumentNullException(nameof(value));
4444
}
4545

4646
_location = value;

src/Microsoft.AspNet.Mvc.Core/ActionResults/FileContentResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public byte[] FileContents
5454
{
5555
if (value == null)
5656
{
57-
throw new ArgumentNullException("value");
57+
throw new ArgumentNullException(nameof(value));
5858
}
5959

6060
_fileContents = value;

src/Microsoft.AspNet.Mvc.Core/ActionResults/FilePathResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public string FileName
6565
{
6666
if (value == null)
6767
{
68-
throw new ArgumentNullException("value");
68+
throw new ArgumentNullException(nameof(value));
6969
}
7070

7171
_fileName = value;

src/Microsoft.AspNet.Mvc.Core/ActionResults/FileStreamResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public Stream FileStream
5858
{
5959
if (value == null)
6060
{
61-
throw new ArgumentNullException("value");
61+
throw new ArgumentNullException(nameof(value));
6262
}
6363

6464
_fileStream = value;

src/Microsoft.AspNet.Mvc.Core/AntiForgery/AntiForgeryOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public string CookieName
3838
{
3939
if (value == null)
4040
{
41-
throw new ArgumentNullException("value",
41+
throw new ArgumentNullException(nameof(value),
4242
Resources.FormatPropertyOfTypeCannotBeNull(
43-
"CookieName", typeof(AntiForgeryOptions)));
43+
nameof(CookieName), typeof(AntiForgeryOptions)));
4444
}
4545

4646
_cookieName = value;
@@ -61,9 +61,9 @@ public string FormFieldName
6161
{
6262
if (value == null)
6363
{
64-
throw new ArgumentNullException("value",
64+
throw new ArgumentNullException(nameof(value),
6565
Resources.FormatPropertyOfTypeCannotBeNull(
66-
"FormFieldName", typeof(AntiForgeryOptions)));
66+
nameof(FormFieldName), typeof(AntiForgeryOptions)));
6767
}
6868

6969
_formFieldName = value;

src/Microsoft.AspNet.Mvc.Core/ControllerActionDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public override string DisplayName
3535
{
3636
if (value == null)
3737
{
38-
throw new ArgumentNullException("value");
38+
throw new ArgumentNullException(nameof(value));
3939
}
4040

4141
base.DisplayName = value;

src/Microsoft.AspNet.Mvc.Core/MvcOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public AntiForgeryOptions AntiForgeryOptions
5050
{
5151
if (value == null)
5252
{
53-
throw new ArgumentNullException("value",
54-
Resources.FormatPropertyOfTypeCannotBeNull("AntiForgeryOptions",
53+
throw new ArgumentNullException(nameof(value),
54+
Resources.FormatPropertyOfTypeCannotBeNull(nameof(AntiForgeryOptions),
5555
typeof(MvcOptions)));
5656
}
5757

src/Microsoft.AspNet.Mvc.Core/RouteDataActionConstraint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private RouteDataActionConstraint(string routeKey)
1414
{
1515
if (routeKey == null)
1616
{
17-
throw new ArgumentNullException("routeKey");
17+
throw new ArgumentNullException(nameof(routeKey));
1818
}
1919

2020
RouteKey = routeKey;

src/Microsoft.AspNet.Mvc.ModelBinding/ModelStateDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public ModelState this[[NotNull] string key]
163163
{
164164
if (value == null)
165165
{
166-
throw new ArgumentNullException("value");
166+
throw new ArgumentNullException(nameof(value));
167167
}
168168
_innerDictionary[key] = value;
169169
}

test/Microsoft.AspNet.Mvc.Razor.Host.Test/SpanFactory/RawTextSymbol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public RawTextSymbol(SourceLocation start, string content)
1919
{
2020
if (content == null)
2121
{
22-
throw new ArgumentNullException("content");
22+
throw new ArgumentNullException(nameof(content));
2323
}
2424

2525
Start = start;

test/Microsoft.AspNet.Mvc.Razor.Test/SpanFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public RawTextSymbol(SourceLocation start, string content)
193193
{
194194
if (content == null)
195195
{
196-
throw new ArgumentNullException("content");
196+
throw new ArgumentNullException(nameof(content));
197197
}
198198

199199
Start = start;

test/Microsoft.AspNet.Mvc.WebApiCompatShimTest/TestUtils/RefTypeTestData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public RefTypeTestData(Func<IEnumerable<T>> testDataProvider)
1717
{
1818
if (testDataProvider == null)
1919
{
20-
throw new ArgumentNullException("testDataProvider");
20+
throw new ArgumentNullException(nameof(testDataProvider));
2121
}
2222

2323
this.testDataProvider = testDataProvider;

0 commit comments

Comments
 (0)