Author: zoltan
Date: 2008-02-19 15:31:50 -0500 (Tue, 19 Feb 2008)
New Revision: 96185
Modified:
trunk/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
Log:
2008-02-18 Zoltan Varga <[EMAIL PROTECTED]>
* CustomAttributeTypedArgument.cs (.ctor): Convert arrays into a
collection of
CustomAttributeTypedArguments to match MS.
Modified:
trunk/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
2008-02-19 20:27:55 UTC (rev 96184)
+++ trunk/mcs/class/corlib/System.Reflection/CustomAttributeTypedArgument.cs
2008-02-19 20:31:50 UTC (rev 96185)
@@ -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