Skip to content

Commit 0f8b53d

Browse files
committed
IList and IEnumerable are ArrayLocalValue
1 parent 78e068b commit 0f8b53d

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

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

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,22 @@ public static LocalValue ConvertFrom(object? value)
8181

8282
case { } when value.GetType().GetInterfaces()
8383
.Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ISet<>)):
84-
IEnumerable set = (IEnumerable)value;
84+
{
85+
IEnumerable set = (IEnumerable)value;
8586

86-
List<LocalValue> setValues = [];
87+
List<LocalValue> setValues = [];
8788

88-
foreach (var obj in set)
89-
{
90-
setValues.Add(ConvertFrom(obj));
91-
}
89+
foreach (var obj in set)
90+
{
91+
setValues.Add(ConvertFrom(obj));
92+
}
9293

93-
return new SetLocalValue(setValues);
94+
return new SetLocalValue(setValues);
95+
}
9496

9597
case IDictionary dictionary:
9698
return ConvertFrom(dictionary);
9799

98-
case IList list:
99-
return ConvertFrom(list);
100-
101100
case IEnumerable enumerable:
102101
return ConvertFrom(enumerable);
103102

@@ -176,23 +175,6 @@ public static LocalValue ConvertFrom(BigInteger? value)
176175
return new NullLocalValue();
177176
}
178177

179-
public static LocalValue ConvertFrom(IList? value)
180-
{
181-
if (value is null)
182-
{
183-
return new NullLocalValue();
184-
}
185-
186-
List<LocalValue> list = [];
187-
188-
foreach (var element in value)
189-
{
190-
list.Add(ConvertFrom(element));
191-
}
192-
193-
return new ArrayLocalValue(list);
194-
}
195-
196178
public static LocalValue ConvertFrom(IEnumerable? value)
197179
{
198180
if (value is null)

0 commit comments

Comments
 (0)