| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- //
- // System.ComponentModel.AmbientValueAttribute
- //
- // Authors:
- // Martin Willemoes Hansen ([email protected])
- // Andreas Nahr ([email protected])
- //
- // (C) 2003 Martin Willemoes Hansen
- // (C) 2003 Andreas Nahr
- //
- namespace System.ComponentModel
- {
- [AttributeUsage(AttributeTargets.All)]
- public sealed class AmbientValueAttribute : Attribute
- {
- private object AmbientValue;
- public AmbientValueAttribute (bool value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (byte value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (char value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (double value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (short value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (int value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (long value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (object value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (float value)
- {
- AmbientValue = value;
- }
- public AmbientValueAttribute (string value)
- {
- AmbientValue = value;
- }
- [MonoTODO]
- public AmbientValueAttribute (Type type, string value)
- {
- try {
- AmbientValue = Convert.ChangeType (value, type);
- } catch {
- AmbientValue = null;
- }
- }
- public object Value {
- get { return AmbientValue; }
- }
- public override bool Equals (object obj)
- {
- if (!(obj is AmbientValueAttribute))
- return false;
- if (obj == this)
- return true;
- return ((AmbientValueAttribute) obj).Value == AmbientValue;
- }
- public override int GetHashCode()
- {
- return AmbientValue.GetHashCode ();
- }
- }
- }
|