2009-07-11 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sat, 11 Jul 2009 17:57:39 +0000 (17:57 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sat, 11 Jul 2009 17:57:39 +0000 (17:57 -0000)
* Binder.cs: Allow conversion of IntPtr to pointer types.

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

mcs/class/corlib/System.Reflection/Binder.cs
mcs/class/corlib/System.Reflection/ChangeLog

index 336eec8933e618a22e0880e47326f5328910303f..33220e5f4484ce22118f504e71b610dd0aa39357 100644 (file)
@@ -222,6 +222,8 @@ namespace System.Reflection
                                                if (type == typeof (float))
                                                        return (float)(char)value;
                                        }
+                                       if (vtype == typeof (IntPtr) && type.IsPointer)
+                                               return value;
                                        return Convert.ChangeType (value, type);
                                }
                                return null;
@@ -349,6 +351,8 @@ namespace System.Reflection
                                        /* TODO: handle valuetype -> byref */
                                        if (to == typeof (object) && from.IsValueType)
                                                return true;
+                                       if (to.IsPointer && from == typeof (IntPtr))
+                                               return true;
 
                                        return to.IsAssignableFrom (from);
                                }
index 827d99b291741a8ebc68e585263fae5773940ed2..698ebb1519bd6a8873f2ce6a3ab738f3f845f2bd 100644 (file)
@@ -1,3 +1,7 @@
+2009-07-11  Zoltan Varga  <vargaz@gmail.com>
+
+       * Binder.cs: Allow conversion of IntPtr to pointer types.
+
 2009-07-10  Zoltan Varga  <vargaz@gmail.com>
 
        * Binder.cs (check_arguments): Allow a type to match its byref version.