/// <summary>
///
/// </summary>
- [MonoTODO]
public static Binder DefaultBinder {
get {
- return null;
+ return Binder.DefaultBinder;
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern Type internal_from_handle (RuntimeTypeHandle handle);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern Type internal_from_name (string name);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type internal_from_name (string name, bool throwOnError, bool ignoreCase);
+
public static Type GetType(string typeName)
{
- return internal_from_name (typeName);
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+
+ return internal_from_name (typeName, false, false);
}
public static Type GetType(string typeName, bool throwOnError)
{
- // LAMESPEC: what kinds of errors cause exception to be thrown?
- return internal_from_name (typeName);
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+
+ Type type = internal_from_name (typeName, throwOnError, false);
+ if (throwOnError && type == null)
+ throw new TypeLoadException ("Error loading '" + typeName + "'");
+
+ return type;
}
- [MonoTODO]
public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
{
- throw new NotImplementedException ();
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+
+ Type t = internal_from_name (typeName, throwOnError, ignoreCase);
+ if (throwOnError && t == null)
+ throw new TypeLoadException ("Error loading '" + typeName + "'");
+
+ return t;
}
public static Type[] GetTypeArray (object[] args) {
public virtual bool IsSubclassOf (Type c)
{
- return type_is_subtype_of (this, c, false);
+ if (c == null)
+ throw new ArgumentNullException ("c");
+
+ return !Equals (c) && type_is_subtype_of (this, c, false);
}
- [MonoTODO]
public virtual Type[] FindInterfaces (TypeFilter filter, object filterCriteria)
{
- // FIXME
- throw new NotImplementedException ();
+ if (filter == null)
+ throw new ArgumentNullException ("filter");
+
+ ArrayList ifaces = new ArrayList ();
+ foreach (Type iface in GetInterfaces ()) {
+ if (filter (iface, filterCriteria))
+ ifaces.Add (iface);
+ }
+
+ return (Type []) ifaces.ToArray (typeof (Type));
}
public Type GetInterface (string name) {
public abstract Type GetInterface (string name, bool ignoreCase);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void GetInterfaceMapData (Type t, Type iface, out MethodInfo[] targets, out MethodInfo[] methods);
+
public virtual InterfaceMapping GetInterfaceMap (Type interfaceType) {
- throw new NotImplementedException ();
+ InterfaceMapping res;
+ if (interfaceType == null)
+ throw new ArgumentNullException ("interfaceType");
+ if (!interfaceType.IsInterface)
+ throw new ArgumentException ("type argument must be an interface", "interfaceType");
+ res.TargetType = this;
+ res.InterfaceType = interfaceType;
+ GetInterfaceMapData (this, interfaceType, out res.TargetMethods, out res.InterfaceMethods);
+ if (res.TargetMethods == null)
+ throw new ArgumentException ("interface not found", "interfaceType");
+
+ return res;
}
public abstract Type[] GetInterfaces ();
public virtual bool IsAssignableFrom (Type c)
{
+ if (c == null)
+ return false;
+
if (Equals (c))
return true;
if (type_is_subtype_of (c, this, true))
- return true;;
+ return true;
if (!IsInterface)
return false;
public abstract PropertyInfo[] GetProperties (BindingFlags bindingAttr);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern PropertyInfo get_property (Type type, string name, Type[] types);
-
public PropertyInfo GetProperty (string name)
{
return GetPropertyImpl (name, DefaultBindingFlags, null, returnType, new Type[0], null);
}
- [MonoTODO]
public PropertyInfo GetProperty (string name, Type[] types)
{
- // TODO: return GetProperty (name, DefaultBindingFlags, null, null, types, null);
- return get_property (this, name, types);
+ return GetProperty (name, DefaultBindingFlags, null, null, types, null);
}
public PropertyInfo GetProperty (string name, Type returnType, Type[] types)
public ConstructorInfo[] GetConstructors ()
{
- return GetConstructors (BindingFlags.Public | BindingFlags.NonPublic);
+ return GetConstructors (BindingFlags.Public | BindingFlags.Instance);
}
public abstract ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
- [MonoTODO]
public virtual MemberInfo[] GetDefaultMembers ()
{
- throw new NotImplementedException ();
+ object [] att = GetCustomAttributes (typeof (DefaultMemberAttribute), true);
+ if (att.Length == 0)
+ return new MemberInfo [0];
+
+ MemberInfo [] member = GetMember (((DefaultMemberAttribute) att [0]).MemberName);
+ return (member != null) ? member : new MemberInfo [0];
}
public virtual MemberInfo[] FindMembers (MemberTypes memberType, BindingFlags bindingAttr,