Skip to content

Commit 50749de

Browse files
committed
Removing is operator in preference to as operator for .NET code
1 parent f336673 commit 50749de

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

dotnet/src/support/Events/EventFiringWebDriver.cs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,20 +1419,6 @@ public void Submit()
14191419
}
14201420
}
14211421

1422-
public override bool Equals(object obj)
1423-
{
1424-
if (!(obj is IWebElement))
1425-
return false;
1426-
1427-
IWebElement other = (IWebElement)obj;
1428-
if(other is IWrapsElement wrapper)
1429-
{
1430-
other = ((IWrapsElement)wrapper).WrappedElement;
1431-
}
1432-
1433-
return underlyingElement.Equals(other);
1434-
}
1435-
14361422
/// <summary>
14371423
/// Click this element. If this causes a new page to load, this method will block until
14381424
/// the page has loaded. At this point, you should discard all references to this element
@@ -1574,6 +1560,28 @@ public ReadOnlyCollection<IWebElement> FindElements(By by)
15741560

15751561
return wrappedElementList.AsReadOnly();
15761562
}
1563+
1564+
/// <summary>
1565+
/// Determines whether the specified <see cref="EventFiringWebElement"/> is equal to the current <see cref="EventFiringWebElement"/>.
1566+
/// </summary>
1567+
/// <param name="obj">The <see cref="EventFiringWebElement"/> to compare to the current <see cref="EventFiringWebElement"/>.</param>
1568+
/// <returns><see langword="true"/> if the specified <see cref="EventFiringWebElement"/> is equal to the current <see cref="EventFiringWebElement"/>; otherwise, <see langword="false"/>.</returns>
1569+
public override bool Equals(object obj)
1570+
{
1571+
IWebElement other = obj as IWebElement;
1572+
if (other == null)
1573+
{
1574+
return false;
1575+
}
1576+
1577+
IWrapsElement otherWrapper = other as IWrapsElement;
1578+
if (otherWrapper != null)
1579+
{
1580+
other = otherWrapper.WrappedElement;
1581+
}
1582+
1583+
return underlyingElement.Equals(other);
1584+
}
15771585
}
15781586
}
15791587
}

0 commit comments

Comments
 (0)