2 using System.Runtime.InteropServices;
3 using System.Collections.ObjectModel;
4 using System.Reflection;
6 namespace Mono.Debugger.Soft {
8 public struct CustomAttributeTypedArgumentMirror {
12 internal CustomAttributeTypedArgumentMirror (Type type, object value)
18 this.type = value.GetType ();
20 this.type = typeof (void);
22 // MS seems to convert arrays into a ReadOnlyCollection
24 Array a = (Array)value;
26 Type etype = a.GetType ().GetElementType ();
27 CustomAttributeTypedArgumentMirror[] new_value = new CustomAttributeTypedArgumentMirror [a.GetLength (0)];
28 for (int i = 0; i < new_value.Length; ++i)
29 new_value [i] = new CustomAttributeTypedArgumentMirror (etype, a.GetValue (i));
30 this.value = new ReadOnlyCollection <CustomAttributeTypedArgumentMirror> (new_value);
34 public Type ArgumentType {
46 public override string ToString ()
48 string val = value != null ? value.ToString () : String.Empty;
49 if (ArgumentType == typeof (string))
50 return "\"" + val + "\"";
51 if (ArgumentType == typeof (Type))
52 return "typeof (" + val + ")";
53 if (ArgumentType.IsEnum)
54 return "(" + ArgumentType.Name + ")" + val;