Skip to content

Commit 7a206a6

Browse files
committed
Update TypeConverter.cs
1 parent 36209e3 commit 7a206a6

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/GraphQL.EntityFramework/Where/TypeConverter.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
4040
}
4141
if (type == typeof(Guid?))
4242
{
43-
return values.Select(s => new Guid?(Guid.Parse(s))).ToList();
43+
return values.Select(_ => (Guid?)Guid.Parse(_)).ToList();
4444
}
4545

4646
if (type == typeof(bool))
@@ -49,7 +49,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
4949
}
5050
if (type == typeof(bool?))
5151
{
52-
return values.Select(s => new bool?(ParseBoolean(s))).ToList();
52+
return values.Select(_ => (bool?)ParseBoolean(_)).ToList();
5353
}
5454

5555
if (type == typeof(int))
@@ -58,7 +58,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
5858
}
5959
if (type == typeof(int?))
6060
{
61-
return values.Select(s => new int?(int.Parse(s))).ToList();
61+
return values.Select(_ => (int?)int.Parse(_)).ToList();
6262
}
6363

6464
if (type == typeof(short))
@@ -67,7 +67,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
6767
}
6868
if (type == typeof(short?))
6969
{
70-
return values.Select(s => new short?(short.Parse(s))).ToList();
70+
return values.Select(_ => (short?)short.Parse(_)).ToList();
7171
}
7272

7373
if (type == typeof(long))
@@ -76,7 +76,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
7676
}
7777
if (type == typeof(long?))
7878
{
79-
return values.Select(s => new long?(long.Parse(s))).ToList();
79+
return values.Select(_ => (long?)long.Parse(_)).ToList();
8080
}
8181

8282
if (type == typeof(uint))
@@ -85,7 +85,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
8585
}
8686
if (type == typeof(uint?))
8787
{
88-
return values.Select(s => new uint?(uint.Parse(s))).ToList();
88+
return values.Select(_ => (uint?)uint.Parse(_)).ToList();
8989
}
9090

9191
if (type == typeof(ushort))
@@ -94,7 +94,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
9494
}
9595
if (type == typeof(ushort?))
9696
{
97-
return values.Select(s => new ushort?(ushort.Parse(s))).ToList();
97+
return values.Select(_ => (ushort?)ushort.Parse(_)).ToList();
9898
}
9999

100100
if (type == typeof(ulong))
@@ -103,7 +103,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
103103
}
104104
if (type == typeof(ulong?))
105105
{
106-
return values.Select(s => new ulong?(ulong.Parse(s))).ToList();
106+
return values.Select(_ => (ulong?)ulong.Parse(_)).ToList();
107107
}
108108

109109
if (type == typeof(DateTime))
@@ -112,7 +112,7 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
112112
}
113113
if (type == typeof(DateTime?))
114114
{
115-
return values.Select(s => new DateTime?(DateTime.Parse(s))).ToList();
115+
return values.Select(_ => (DateTime?)DateTime.Parse(_)).ToList();
116116
}
117117

118118
if (type == typeof(DateTimeOffset))
@@ -121,12 +121,12 @@ static IList ConvertStringsToListInternal(IEnumerable<string> values, Type type)
121121
}
122122
if (type == typeof(DateTimeOffset?))
123123
{
124-
return values.Select(s => new DateTimeOffset?(DateTimeOffset.Parse(s))).ToList();
124+
return values.Select(_ => (DateTimeOffset?)DateTimeOffset.Parse(_)).ToList();
125125
}
126126

127127
if (type.TryGetEnumType(out var enumType))
128128
{
129-
return values.Select(s => Enum.Parse(enumType, s, true))
129+
return values.Select(_ => Enum.Parse(enumType, _, true))
130130
.ToList();
131131
}
132132

0 commit comments

Comments
 (0)