System.ComponentModel.DefaultValueAttribute.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;
            }

            DefaultValueAttribute other = obj as DefaultValueAttribute;

            if (other != null)
            {
                if (Value != null)
                {
                    return Value.Equals(other.Value);
                }
                else
                {
                    return (other.Value == null);
                }
            }
            return false;
        }

Usage Example

		public void Bool ()
		{
			DefaultValueAttribute dvat = new DefaultValueAttribute (true);
			Assert.IsTrue ((bool) dvat.Value, "Value");

			Assert.IsFalse (dvat.Equals (true), "Equals(true)");
			Assert.IsTrue (dvat.Equals (new DefaultValueAttribute (true)), "Equals(new)");

			Assert.AreEqual (true.GetHashCode (), dvat.GetHashCode (), "GetHashCode");
		}
All Usage Examples Of System.ComponentModel.DefaultValueAttribute::Equals