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

Commit 40cfc23

Browse files
committed
Use nameof operator
1 parent 6407a16 commit 40cfc23

19 files changed

+31
-31
lines changed

src/Microsoft.AspNet.Http.Abstractions/Extensions/MapExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static IApplicationBuilder Map([NotNull] this IApplicationBuilder app, Pa
2222
{
2323
if (pathMatch.HasValue && pathMatch.Value.EndsWith("/", StringComparison.Ordinal))
2424
{
25-
throw new ArgumentException("The path must not end with a '/'", "pathMatch");
25+
throw new ArgumentException("The path must not end with a '/'", nameof(pathMatch));
2626
}
2727

2828
// create branch

src/Microsoft.AspNet.Http.Abstractions/FragmentString.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public FragmentString(string value)
2727
{
2828
if (!string.IsNullOrEmpty(value) && value[0] != '#')
2929
{
30-
throw new ArgumentException("The leading '#' must be included for a non-empty fragment.", "value");
30+
throw new ArgumentException("The leading '#' must be included for a non-empty fragment.", nameof(value));
3131
}
3232
_value = value;
3333
}

src/Microsoft.AspNet.Http.Abstractions/PathString.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public PathString(string value)
2929
{
3030
if (!String.IsNullOrEmpty(value) && value[0] != '/')
3131
{
32-
throw new ArgumentException(""/*Resources.Exception_PathMustStartWithSlash*/, "value");
32+
throw new ArgumentException(""/*Resources.Exception_PathMustStartWithSlash*/, nameof(value));
3333
}
3434
_value = value;
3535
}

src/Microsoft.AspNet.Http.Abstractions/QueryString.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public QueryString(string value)
3030
{
3131
if (!string.IsNullOrEmpty(value) && value[0] != '?')
3232
{
33-
throw new ArgumentException("The leading '?' must be included for a non-empty query.", "value");
33+
throw new ArgumentException("The leading '?' must be included for a non-empty query.", nameof(value));
3434
}
3535
_value = value;
3636
}

src/Microsoft.AspNet.Http/ReferenceReadStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public override long Position
5757
ThrowIfDisposed();
5858
if (value < 0 || value > Length)
5959
{
60-
throw new ArgumentOutOfRangeException("value", value, "The Position must be within the length of the Stream: " + Length);
60+
throw new ArgumentOutOfRangeException(nameof(value), value, "The Position must be within the length of the Stream: " + Length);
6161
}
6262
VerifyPosition();
6363
_position = value;

src/Microsoft.AspNet.Owin/OwinEnvironment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ public OwinEnvironment(HttpContext context)
3737
{
3838
if (context.GetFeature<IHttpRequestFeature>() == null)
3939
{
40-
throw new ArgumentException("Missing required feature: " + nameof(IHttpRequestFeature) + ".", "context");
40+
throw new ArgumentException("Missing required feature: " + nameof(IHttpRequestFeature) + ".", nameof(context));
4141
}
4242
if (context.GetFeature<IHttpResponseFeature>() == null)
4343
{
44-
throw new ArgumentException("Missing required feature: " + nameof(IHttpResponseFeature) + ".", "context");
44+
throw new ArgumentException("Missing required feature: " + nameof(IHttpResponseFeature) + ".", nameof(context));
4545
}
4646

4747
_context = context;

src/Microsoft.AspNet.Owin/OwinFeatureCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public void CopyTo([NotNull] KeyValuePair<Type, object>[] array, int arrayIndex)
411411
{
412412
if (arrayIndex < 0 || arrayIndex > array.Length)
413413
{
414-
throw new ArgumentOutOfRangeException("arrayIndex", arrayIndex, string.Empty);
414+
throw new ArgumentOutOfRangeException(nameof(arrayIndex), arrayIndex, string.Empty);
415415
}
416416
var keys = Keys;
417417
if (keys.Count > array.Length - arrayIndex)

src/Microsoft.AspNet.Owin/WebSockets/OwinWebSocketAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private static WebSocketMessageType OpCodeToEnum(int messageType)
169169
case 0x8:
170170
return WebSocketMessageType.Close;
171171
default:
172-
throw new ArgumentOutOfRangeException("messageType", messageType, string.Empty);
172+
throw new ArgumentOutOfRangeException(nameof(messageType), messageType, string.Empty);
173173
}
174174
}
175175

@@ -184,7 +184,7 @@ private static int EnumToOpCode(WebSocketMessageType webSocketMessageType)
184184
case WebSocketMessageType.Close:
185185
return 0x8;
186186
default:
187-
throw new ArgumentOutOfRangeException("webSocketMessageType", webSocketMessageType, string.Empty);
187+
throw new ArgumentOutOfRangeException(nameof(webSocketMessageType), webSocketMessageType, string.Empty);
188188
}
189189
}
190190
}

src/Microsoft.AspNet.WebUtilities/BufferedReadStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public override long Position
6464
{
6565
if (value < 0)
6666
{
67-
throw new ArgumentOutOfRangeException("value", value, "Position must be positive.");
67+
throw new ArgumentOutOfRangeException(nameof(value), value, "Position must be positive.");
6868
}
6969
if (value == Position)
7070
{

src/Microsoft.AspNet.WebUtilities/MultipartReaderStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ public override long Position
7070
{
7171
if (value < 0)
7272
{
73-
throw new ArgumentOutOfRangeException("value", value, "The Position must be positive.");
73+
throw new ArgumentOutOfRangeException(nameof(value), value, "The Position must be positive.");
7474
}
7575
if (value > _observedLength)
7676
{
77-
throw new ArgumentOutOfRangeException("value", value, "The Position must be less than length.");
77+
throw new ArgumentOutOfRangeException(nameof(value), value, "The Position must be less than length.");
7878
}
7979
_position = value;
8080
if (_position < _observedLength)

0 commit comments

Comments
 (0)