Moved ProviderCollectionTest.cs from System assembly to System.Configuration.
[mono.git] / mcs / class / corlib / System.Reflection / FieldInfo.cs
index 1aaaf00207df5442ae75700aec4fc6725c179a35..f019bc2d7821b4c209d69ef7cf1e3850a09bf54d 100644 (file)
@@ -132,7 +132,7 @@ namespace System.Reflection {
                        }
                }
 
-               public abstract void SetValue (object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
+               public abstract void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
 
 #if ONLY_1_1
                public new Type GetType ()
@@ -149,13 +149,25 @@ namespace System.Reflection {
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               private static extern FieldInfo internal_from_handle (IntPtr handle);
+               private static extern FieldInfo internal_from_handle_type (IntPtr field_handle, IntPtr type_handle);
 
                public static FieldInfo GetFieldFromHandle (RuntimeFieldHandle handle)
                {
-                       return internal_from_handle (handle.Value);
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       return internal_from_handle_type (handle.Value, IntPtr.Zero);
                }
 
+#if NET_2_0
+               [ComVisible (false)]
+               public static FieldInfo GetFieldFromHandle (RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       return internal_from_handle_type (handle.Value, declaringType.Value);
+               }
+#endif
+
                //
                // Note: making this abstract imposes an implementation requirement
                //       on any class that derives from it.  However, since it's also
@@ -172,14 +184,14 @@ namespace System.Reflection {
                }
 
                [CLSCompliant(false)]
-               [MonoTODO]
+               [MonoTODO("Not implemented")]
                public virtual object GetValueDirect (TypedReference obj)
                {
                        throw new NotImplementedException ();
                }
 
                [CLSCompliant(false)]
-               [MonoTODO]
+               [MonoTODO("Not implemented")]
                public virtual void SetValueDirect (TypedReference obj, object value)
                {
                        throw new NotImplementedException ();
@@ -224,14 +236,21 @@ namespace System.Reflection {
                }
 
 #if NET_2_0 || BOOTSTRAP_NET_2_0
-               [MonoTODO]
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               extern Type[] GetTypeModifiers (bool optional);
+
                public virtual Type[] GetOptionalCustomModifiers () {
-                       throw new NotImplementedException ();
+                       Type[] types = GetTypeModifiers (true);
+                       if (types == null)
+                               return Type.EmptyTypes;
+                       return types;
                }
 
-               [MonoTODO]
                public virtual Type[] GetRequiredCustomModifiers () {
-                       throw new NotImplementedException ();
+                       Type[] types = GetTypeModifiers (false);
+                       if (types == null)
+                               return Type.EmptyTypes;
+                       return types;
                }
 
                public virtual object GetRawConstantValue ()