From 50749de1e28503c988c6a8c2318360f8a1f1b545 Mon Sep 17 00:00:00 2001 From: Jim Evans Date: Tue, 17 Mar 2020 10:03:12 -0700 Subject: [PATCH] Removing is operator in preference to as operator for .NET code --- .../support/Events/EventFiringWebDriver.cs | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/dotnet/src/support/Events/EventFiringWebDriver.cs b/dotnet/src/support/Events/EventFiringWebDriver.cs index 46cf4aaf2fbcd..4d955f3ed845d 100644 --- a/dotnet/src/support/Events/EventFiringWebDriver.cs +++ b/dotnet/src/support/Events/EventFiringWebDriver.cs @@ -1419,20 +1419,6 @@ public void Submit() } } - public override bool Equals(object obj) - { - if (!(obj is IWebElement)) - return false; - - IWebElement other = (IWebElement)obj; - if(other is IWrapsElement wrapper) - { - other = ((IWrapsElement)wrapper).WrappedElement; - } - - return underlyingElement.Equals(other); - } - /// /// Click this element. If this causes a new page to load, this method will block until /// the page has loaded. At this point, you should discard all references to this element @@ -1574,6 +1560,28 @@ public ReadOnlyCollection FindElements(By by) return wrappedElementList.AsReadOnly(); } + + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare to the current . + /// if the specified is equal to the current ; otherwise, . + public override bool Equals(object obj) + { + IWebElement other = obj as IWebElement; + if (other == null) + { + return false; + } + + IWrapsElement otherWrapper = other as IWrapsElement; + if (otherWrapper != null) + { + other = otherWrapper.WrappedElement; + } + + return underlyingElement.Equals(other); + } } } }