33 private object _value;
36 public static Any VOID =
new Any(typeof(
void),
null);
43 &&
type != typeof(
void)
44 &&
type != typeof(
object)
45 &&
type.IsInterface ==
false))
46 throw new System.Exception(
47 "uno.Any: Constructor called with illegal arguments!");
52 TypeParametersAttribute
t = (TypeParametersAttribute)
Attribute.GetCustomAttribute(
53 value.GetType(), typeof(TypeParametersAttribute));
54 if (t !=
null && !(
type is PolymorphicType))
55 throw new System.Exception(
56 "uno.Any: The value has a polymorphic type but the type argument is not " +
57 "uno.PolymorphicType. Please use the constructor Any(Type, object) and " +
58 "supply a uno.PolymorphicType as type argument!");
103 public Any(
char value): this(typeof(char),
value)
107 public Any(
bool value): this(typeof(bool),
value)
115 public Any(
short value): this(typeof(short),
value)
131 public Any(
long value): this(typeof(long),
value)
135 public Any(ulong
value): this(typeof(ulong),
value)
139 public Any(
float value): this(typeof(float),
value)
143 public Any(
double value): this(typeof(double),
value)
151 public Any(
string value): this(typeof(string),
value)
155 public override string ToString()
157 StringBuilder msg =
new StringBuilder(
"uno.Any { Type= ");
158 msg.Append(
Type.ToString());
159 msg.Append(
", Value=");
160 msg.Append(Value.ToString());
162 return msg.ToString();
165 public bool hasValue()
167 if (
Type ==
null ||
Type == typeof(
void))
172 public override bool Equals(
object obj)
178 return Equals((Any) obj);
180 catch (InvalidCastException)
187 public bool Equals(Any obj)
189 return Type.Equals(obj.Type)
192 Value.Equals(obj.Value));
195 public override int GetHashCode()
197 return Type.GetHashCode() ^ (Value !=
null ? Value.GetHashCode() : 0);
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int