2002-10-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 1 Oct 2002 16:15:12 +0000 (16:15 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 1 Oct 2002 16:15:12 +0000 (16:15 -0000)
* MonoProperty.cs:
* PropertyInfo.cs: fixed bug #31535.

svn path=/trunk/mcs/; revision=7906

mcs/class/corlib/System.Reflection/ChangeLog
mcs/class/corlib/System.Reflection/MonoProperty.cs
mcs/class/corlib/System.Reflection/PropertyInfo.cs

index aa414f13b098854641fde644975b0165a0c0e8ac..0a5f1c6ea90b2dadd2d977e3552c43667b2283dd 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * MonoProperty.cs:
+       * PropertyInfo.cs: fixed bug #31535.
+
 2002-09-27  Martin Baulig  <martin@gnome.org>
 
        * Assembly.cs (Assembly.GetReferencedAssemblies): Implemented.
@@ -21,6 +26,7 @@
 Wed Sep 11 12:50:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
 
        * Binder.cs: more default binder implementation.
+
        * FieldInfo.cs, MonoField.cs: fixed SetValue () implementation.
        * MonoMethod.cs: use the binder in the Invoke () implementation.
        Implemented custom attributes methods and ToString for constructors.
index cbf0c3230c3f58e79b6f7eeb75f85719ca6b84b4..f52568c4d14d1c35dbfae97e5c8eeaf121a66b9f 100755 (executable)
@@ -143,6 +143,8 @@ namespace System.Reflection {
                        object ret = null;
 
                        MethodInfo method = GetGetMethod (false);
+                       if (method == null)
+                               throw new ArgumentException ("Get Method not found for '" + Name + "'");
                        
                        if (index == null || index.Length == 0) 
                                ret = method.Invoke (obj, invokeAttr, binder, null, culture);
@@ -153,6 +155,21 @@ namespace System.Reflection {
                }
 
                public override void SetValue( object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+                       MethodInfo method = GetSetMethod (false);
+                       if (method == null)
+                               throw new ArgumentException ("Set Method not found for '" + Name + "'");
+                       
+                       object [] parms;
+                       if (index == null || index.Length == 0) 
+                               parms = new object [] {value};
+                       else {
+                               int ilen = index.Length;
+                               parms = new object [ilen+ 1];
+                               index.CopyTo (parms, 0);
+                               parms [ilen] = value;
+                       }
+
+                       method.Invoke (obj, invokeAttr, binder, parms, culture);
                }
 
                public override string ToString () {
index 383bef59fc85f2c2a379210d2156beccb2312857..d9654428aee69ffa4aa72189035b5081c5f4c088 100755 (executable)
@@ -49,6 +49,7 @@ namespace System.Reflection {
                }
                public abstract object GetValue( object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
                public virtual void SetValue( object obj, object value, object[] index) {
+                       SetValue (obj, value, BindingFlags.Default, null, index, null);
                }
                public abstract void SetValue( object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
        }