Esempio n. 1
0
        /// <summary>
        /// Checks if the specified object is equal to this.
        /// </summary>
        /// <param name="otherHandleBase">The other object that is to be tested for equality.</param>
        /// <returns>Returns <c>true</c> if both objects point to the same underlying unmanaged memory and <c>false</c> otherwise.</returns>
        public bool Equals(HandleBase otherHandleBase)
        {
            // Checks if the other object is null, in that case it is not equal to this object
            if (otherHandleBase == null)
            {
                return(false);
            }

            // Checks if the handles, that both objects contain are the same, in that case they are equal, if not they are not equal
            return(Handle == otherHandleBase.Handle);
        }
Esempio n. 2
0
        /// <summary>
        /// Checks if the specified object is equal to this.
        /// </summary>
        /// <param name="obj">The other object that is to be tested for equality.</param>
        /// <returns>Returns <c>true</c> if both objects point to the same underlying unmanaged memory and <c>false</c> otherwise.</returns>
        public override bool Equals(object obj)
        {
            // Checks if the other object is null, in that case it is not equal to this object
            if (obj == null)
            {
                return(false);
            }

            // Checks if the other object can be cast into a HandleBase, if not, then it is not equal to this object
            HandleBase otherHandleBase = obj as HandleBase;

            if (otherHandleBase == null)
            {
                return(false);
            }

            // Checks if the handles, that both objects contain are the same, in that case they are equal, if not they are not equal
            return(Handle == otherHandleBase.Handle);
        }