//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using System;
using System.Security.Permissions;
///
///
/// Indicates whether the parent property is notified
/// if a child namespace property is modified.
///
///
[AttributeUsage(AttributeTargets.Property)]
public sealed class NotifyParentPropertyAttribute : Attribute {
///
///
/// Specifies that the parent property should be notified on changes to the child class property. This field is read-only.
///
///
public static readonly NotifyParentPropertyAttribute Yes = new NotifyParentPropertyAttribute(true);
///
/// Specifies that the parent property should not be notified of changes to the child class property. This field is read-only.
///
public static readonly NotifyParentPropertyAttribute No = new NotifyParentPropertyAttribute(false);
///
/// Specifies the default attribute state, that the parent property should not be notified of changes to the child class property.
/// This field is read-only.
///
public static readonly NotifyParentPropertyAttribute Default = No;
private bool notifyParent = false;
///
/// Initiailzes a new instance of the NotifyPropertyAttribute class
/// that uses the specified value
/// to indicate whether the parent property should be notified when a child namespace property is modified.
///
public NotifyParentPropertyAttribute(bool notifyParent) {
this.notifyParent = notifyParent;
}
///
///
/// Gets or sets whether the parent property should be notified
/// on changes to a child namespace property.
///
///
public bool NotifyParent {
get {
return notifyParent;
}
}
///
///
/// Tests whether the specified object is the same as the current object.
///
///
public override bool Equals(object obj) {
if (obj == this) {
return true;
}
if ((obj != null) && (obj is NotifyParentPropertyAttribute)) {
return ((NotifyParentPropertyAttribute)obj).NotifyParent == notifyParent;
}
return false;
}
///
///
/// Returns the hashcode for this object.
///
///
public override int GetHashCode() {
return base.GetHashCode();
}
///
///
/// Gets whether this attribute is by default.
///
///
public override bool IsDefaultAttribute() {
return this.Equals(Default);
}
}
}