Skip to content

Commit 0e48e9a

Browse files
committed
参数异常的参数名nameof化
1 parent b56fc8a commit 0e48e9a

19 files changed

+29
-28
lines changed

WebApiClient/Attributes/FormFieldAttribute.cs

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

4646
this.name = name;

WebApiClient/Attributes/HeaderAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public HeaderAttribute(string name, string value)
6767
{
6868
if (string.IsNullOrEmpty(name))
6969
{
70-
throw new ArgumentNullException("name");
70+
throw new ArgumentNullException(nameof(name));
7171
}
7272
this.name = name;
7373
this.value = value;

WebApiClient/Attributes/HttpActionAttributes/ProxyAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public ProxyAttribute(string host, int port, string userName, string password)
5353
{
5454
if (string.IsNullOrEmpty(host))
5555
{
56-
throw new ArgumentNullException("host");
56+
throw new ArgumentNullException(nameof(host));
5757
}
5858

5959
this.host = host;

WebApiClient/Attributes/HttpActionAttributes/TimeoutAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public TimeoutAttribute(int milliseconds)
2727
{
2828
if (milliseconds <= 0)
2929
{
30-
throw new ArgumentOutOfRangeException();
30+
throw new ArgumentOutOfRangeException(nameof(milliseconds));
3131
}
3232
this.TimeSpan = TimeSpan.FromMilliseconds(milliseconds);
3333
}

WebApiClient/Attributes/MulitpartTextAttribute.cs

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

4646
this.name = name;

WebApiClient/Attributes/ParameterAttributes/XmlContentAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private XmlContentAttribute(Encoding encoding)
5050
{
5151
if (encoding == null)
5252
{
53-
throw new ArgumentNullException();
53+
throw new ArgumentNullException(nameof(encoding));
5454
}
5555
this.encoding = encoding;
5656
}

WebApiClient/DataAnnotations/AliasAsAttribute.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace WebApiClient
88
{
99
/// <summary>
1010
/// 表示将参数名或属性名进行别名
11-
/// 当修饰属性时,Json或KeyValueFormatter序列化将使用此别名
11+
/// 当修饰属性时,JsonFormatter或KeyValueFormatter序列化将使用此别名
1212
/// </summary>
1313
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
1414
public sealed class AliasAsAttribute : Attribute
@@ -22,11 +22,12 @@ public sealed class AliasAsAttribute : Attribute
2222
/// 指定参数或属性的别名
2323
/// </summary>
2424
/// <param name="name">参数或属性的别名</param>
25+
/// <exception cref="ArgumentNullException"></exception>
2526
public AliasAsAttribute(string name)
2627
{
2728
if (string.IsNullOrWhiteSpace(name) == true)
2829
{
29-
throw new ArgumentNullException("alias");
30+
throw new ArgumentNullException(nameof(name));
3031
}
3132
this.Name = name;
3233
}

WebApiClient/DataAnnotations/DateTimeFormatAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace WebApiClient
88
{
99
/// <summary>
10-
/// 表示属性在Json或KeyValueFormatter序列化时使用的日期时间格式
10+
/// 表示属性在JsonFormatter或KeyValueFormatter序列化时使用的日期时间格式
1111
/// </summary>
1212
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
1313
public sealed class DateTimeFormatAttribute : Attribute
@@ -26,7 +26,7 @@ public DateTimeFormatAttribute(string format)
2626
{
2727
if (string.IsNullOrEmpty(format))
2828
{
29-
throw new ArgumentNullException("format");
29+
throw new ArgumentNullException(nameof(format));
3030
}
3131
this.Format = format;
3232
}

WebApiClient/DataAnnotations/IgnoreSerializedAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace WebApiClient
88
{
99
/// <summary>
10-
/// 表示当Json或KeyValueFormatter序列化对象时,此属性将忽略
10+
/// 表示当JsonFormatter或KeyValueFormatter序列化对象时,此属性将忽略
1111
/// </summary>
1212
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
1313
public sealed class IgnoreSerializedAttribute : Attribute

WebApiClient/FormatOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public string DateTimeFormat
3838
{
3939
if (string.IsNullOrEmpty(value))
4040
{
41-
throw new ArgumentNullException();
41+
throw new ArgumentNullException(nameof(value));
4242
}
4343
this.dateTimeFormat = value;
4444
}

0 commit comments

Comments
 (0)