Skip to content

Commit ef8c5db

Browse files
committed
Non-generic IEnumerable
1 parent 013be9b commit ef8c5db

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

dotnet/src/webdriver/BiDi/Modules/Script/LocalValue.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public static LocalValue ConvertFrom(object? value)
9494
case IList set:
9595
return ConvertFrom(set);
9696

97-
case IEnumerable<object?> list:
98-
return ConvertFrom(list);
97+
case IEnumerable enumerable:
98+
return ConvertFrom(enumerable);
9999

100100
default:
101101
return ReflectionBasedConvertFrom(value);
@@ -172,18 +172,24 @@ public static LocalValue ConvertFrom(BigInteger? value)
172172
return new NullLocalValue();
173173
}
174174

175-
public static LocalValue ConvertFrom(IEnumerable<object?>? value)
175+
public static LocalValue ConvertFrom(IList? value)
176176
{
177177
if (value is null)
178178
{
179179
return new NullLocalValue();
180180
}
181181

182-
LocalValue[] convertedList = [.. value.Select(ConvertFrom)];
183-
return new ArrayLocalValue(convertedList);
182+
List<LocalValue> list = [];
183+
184+
foreach (var element in value)
185+
{
186+
list.Add(ConvertFrom(element));
187+
}
188+
189+
return new ArrayLocalValue(list);
184190
}
185191

186-
public static LocalValue ConvertFrom(IList? value)
192+
public static LocalValue ConvertFrom(IEnumerable? value)
187193
{
188194
if (value is null)
189195
{

0 commit comments

Comments
 (0)