Skip to content

Commit eb3dd0f

Browse files
committed
cleanup
1 parent b9561da commit eb3dd0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dotnet/src/webdriver/WebDriver.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,11 +1004,11 @@ private static void UnpackAndThrowOnError(Response errorResponse, string command
10041004
else if (responseValue is object?[] resultAsArray)
10051005
{
10061006
bool allElementsAreWebElements = true;
1007-
List<object?> toReturn = new List<object?>();
1007+
List<object?> toReturn = new List<object?>(resultAsArray.Length);
10081008
foreach (object? item in resultAsArray)
10091009
{
10101010
object? parsedItem = this.ParseJavaScriptReturnValue(item);
1011-
if (parsedItem is not IWebElement parsedItemAsElement)
1011+
if (parsedItem is not IWebElement)
10121012
{
10131013
allElementsAreWebElements = false;
10141014
}
@@ -1018,7 +1018,7 @@ private static void UnpackAndThrowOnError(Response errorResponse, string command
10181018

10191019
if (toReturn.Count > 0 && allElementsAreWebElements)
10201020
{
1021-
List<IWebElement> elementList = new List<IWebElement>();
1021+
List<IWebElement> elementList = new List<IWebElement>(resultAsArray.Length);
10221022
foreach (object? listItem in toReturn)
10231023
{
10241024
elementList.Add((IWebElement)listItem!);

0 commit comments

Comments
 (0)