Skip to content

Commit 0b54e83

Browse files
committed
去掉无效null检测
1 parent db44afc commit 0b54e83

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

WebApiClient/Internal/DefaultKeyValueFormatter.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ public IEnumerable<KeyValuePair<string, string>> Serialize(string name, object o
7979
/// <returns></returns>
8080
private IEnumerable<KeyValuePair<string, string>> ForamtAsEnumerable(string name, IEnumerable enumerable, FormatOptions options)
8181
{
82-
if (enumerable == null)
83-
{
84-
return Enumerable.Empty<KeyValuePair<string, string>>();
85-
}
86-
8782
return from item in enumerable.Cast<object>()
8883
select this.FormatAsSimple(name, item, options);
8984
}
@@ -96,11 +91,6 @@ private IEnumerable<KeyValuePair<string, string>> ForamtAsEnumerable(string name
9691
/// <returns></returns>
9792
private IEnumerable<KeyValuePair<string, string>> FormatAsComplex(object instance, FormatOptions options)
9893
{
99-
if (instance == null)
100-
{
101-
return Enumerable.Empty<KeyValuePair<string, string>>();
102-
}
103-
10494
return
10595
from p in PropertyDescriptor.GetProperties(instance.GetType())
10696
where p.IsSupportGet && p.IgnoreSerialized == false
@@ -117,10 +107,6 @@ from p in PropertyDescriptor.GetProperties(instance.GetType())
117107
/// <returns></returns>
118108
private IEnumerable<KeyValuePair<string, string>> FormatAsDictionary<TValue>(IDictionary<string, TValue> dic, FormatOptions options)
119109
{
120-
if (dic == null)
121-
{
122-
return Enumerable.Empty<KeyValuePair<string, string>>();
123-
}
124110
return from kv in dic select this.FormatAsSimple(kv.Key, kv.Value, options);
125111
}
126112

0 commit comments

Comments
 (0)