LocalizableAttribute.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // System.ComponentModel.LocalizableAttribute.cs
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // (C) Ximian, Inc. http://www.ximian.com
  9. // (C) 2003 Andreas Nahr
  10. //
  11. //
  12. using System;
  13. namespace System.ComponentModel {
  14. [AttributeUsage (AttributeTargets.Property)]
  15. public sealed class LocalizableAttribute : Attribute
  16. {
  17. private bool localizable;
  18. public static readonly LocalizableAttribute Default = new LocalizableAttribute (false);
  19. public static readonly LocalizableAttribute No = new LocalizableAttribute (false);
  20. public static readonly LocalizableAttribute Yes = new LocalizableAttribute (true);
  21. public LocalizableAttribute (bool localizable)
  22. {
  23. this.localizable = localizable;
  24. }
  25. public bool IsLocalizable {
  26. get {
  27. return localizable;
  28. }
  29. }
  30. public override bool Equals (object obj)
  31. {
  32. if (!(obj is LocalizableAttribute))
  33. return false;
  34. if (obj == this)
  35. return true;
  36. return ((LocalizableAttribute) obj).IsLocalizable == localizable;
  37. }
  38. public override int GetHashCode ()
  39. {
  40. return localizable.GetHashCode ();
  41. }
  42. public override bool IsDefaultAttribute ()
  43. {
  44. return localizable == LocalizableAttribute.Default.IsLocalizable;
  45. }
  46. }
  47. }