Author: zoltan
Date: 2008-02-18 15:51:54 -0500 (Mon, 18 Feb 2008)
New Revision: 96102

Modified:
   branches/mono-1-9/mcs/class/corlib/System.Reflection/ChangeLog
   
branches/mono-1-9/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
Log:
Merge from HEAD.


Modified: branches/mono-1-9/mcs/class/corlib/System.Reflection/ChangeLog
===================================================================
--- branches/mono-1-9/mcs/class/corlib/System.Reflection/ChangeLog      
2008-02-18 20:35:55 UTC (rev 96101)
+++ branches/mono-1-9/mcs/class/corlib/System.Reflection/ChangeLog      
2008-02-18 20:51:54 UTC (rev 96102)
@@ -1,3 +1,9 @@
+2008-02-18  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * CustomAttributeTypedArgument.cs (.ctor): Convert arrays into a
+       collection of
+               CustomAttributeTypedArguments to match MS.
+
 2008-01-22  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * MonoGenericClass.cs: Make this NET 2.0 only.

Modified: 
branches/mono-1-9/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
===================================================================
--- 
branches/mono-1-9/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
        2008-02-18 20:35:55 UTC (rev 96101)
+++ 
branches/mono-1-9/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
        2008-02-18 20:51:54 UTC (rev 96102)
@@ -31,6 +31,7 @@
 
 using System;
 using System.Runtime.InteropServices;
+using System.Collections.ObjectModel;
 
 namespace System.Reflection {
 
@@ -44,6 +45,17 @@
                {
                        this.argumentType = argumentType;
                        this.value = value;
+
+                       // MS seems to convert arrays into a ReadOnlyCollection
+                       if (value is Array) {
+                               Array a = (Array)value;
+
+                               Type etype = a.GetType ().GetElementType ();
+                               CustomAttributeTypedArgument[] new_value = new 
CustomAttributeTypedArgument [a.GetLength (0)];
+                               for (int i = 0; i < new_value.Length; ++i)
+                                       new_value [i] = new 
CustomAttributeTypedArgument (etype, a.GetValue (i));
+                               this.value = new ReadOnlyCollection 
<CustomAttributeTypedArgument> (new_value);
+                       }
                }
 
                public Type ArgumentType {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to