PersistChildrenAttribute.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // System.Web.UI.PersistChildrenAttribute.cs
  3. //
  4. // Duncan Mak ([email protected])
  5. //
  6. // (C) Ximian, Inc.
  7. //
  8. using System;
  9. namespace System.Web.UI {
  10. [AttributeUsage (AttributeTargets.Class)]
  11. public sealed class PersistChildrenAttribute : Attribute
  12. {
  13. bool persist;
  14. public PersistChildrenAttribute (bool persist)
  15. {
  16. this.persist = persist;
  17. }
  18. public static readonly PersistChildrenAttribute Default = new PersistChildrenAttribute (true);
  19. public static readonly PersistChildrenAttribute Yes = new PersistChildrenAttribute (true);
  20. public static readonly PersistChildrenAttribute No = new PersistChildrenAttribute (false);
  21. public bool Persist {
  22. get { return persist; }
  23. }
  24. public override bool Equals (object obj)
  25. {
  26. if (!(obj is PersistChildrenAttribute))
  27. return false;
  28. return (((PersistChildrenAttribute) obj).persist == persist);
  29. }
  30. public override int GetHashCode ()
  31. {
  32. return persist ? 1 : 0;
  33. }
  34. public override bool IsDefaultAttribute ()
  35. {
  36. return (persist == true);
  37. }
  38. }
  39. }