NotifyParentPropertyAttribute.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // System.ComponentModel.NotifyParentPropertyAttribute.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // Copyright (C) Tim Coleman, 2002
  9. // (C) 2003 Andreas Nahr
  10. //
  11. //
  12. namespace System.ComponentModel {
  13. [AttributeUsage (AttributeTargets.Property)]
  14. public sealed class NotifyParentPropertyAttribute : Attribute {
  15. #region Fields
  16. private bool notifyParent;
  17. #endregion // Fields
  18. public static readonly NotifyParentPropertyAttribute Default = new NotifyParentPropertyAttribute (false);
  19. public static readonly NotifyParentPropertyAttribute No = new NotifyParentPropertyAttribute (false);
  20. public static readonly NotifyParentPropertyAttribute Yes = new NotifyParentPropertyAttribute (true);
  21. #region Constructors
  22. public NotifyParentPropertyAttribute (bool notifyParent)
  23. {
  24. this.notifyParent = notifyParent;
  25. }
  26. #endregion // Constructors
  27. #region Properties
  28. public bool NotifyParent {
  29. get { return notifyParent; }
  30. }
  31. #endregion // Properties
  32. #region Methods
  33. public override bool Equals (object obj)
  34. {
  35. if (!(obj is NotifyParentPropertyAttribute))
  36. return false;
  37. if (obj == this)
  38. return true;
  39. return ((NotifyParentPropertyAttribute) obj).NotifyParent == notifyParent;
  40. }
  41. public override int GetHashCode ()
  42. {
  43. return notifyParent.GetHashCode ();
  44. }
  45. public override bool IsDefaultAttribute ()
  46. {
  47. return notifyParent == NotifyParentPropertyAttribute.Default.NotifyParent;
  48. }
  49. #endregion // Methods
  50. }
  51. }