System.ComponentModel.EditorBrowsableAttribute.Equals C# (CSharp) Method

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return true;
            }

            EditorBrowsableAttribute other = obj as EditorBrowsableAttribute;

            return (other != null) && other.browsableState == browsableState;
        }

Usage Example

Esempio n. 1
0
        public static void TestEqual()
        {
            var attr = new EditorBrowsableAttribute(EditorBrowsableState.Advanced);
            Assert.Equal(attr, attr);
            Assert.True(attr.Equals(attr));
            Assert.Equal(attr.GetHashCode(), attr.GetHashCode());

            Assert.Equal(new EditorBrowsableAttribute(EditorBrowsableState.Advanced), attr);
            Assert.Equal(new EditorBrowsableAttribute(EditorBrowsableState.Advanced).GetHashCode(), attr.GetHashCode());

            Assert.NotEqual(new EditorBrowsableAttribute(EditorBrowsableState.Always), attr);
            Assert.NotEqual(new EditorBrowsableAttribute(EditorBrowsableState.Never).GetHashCode(), attr.GetHashCode());
            Assert.False(attr.Equals(null));
        }