コード例 #1
0
        internal CustomAttributeTypedArgumentMirror(Type type, object value)
        {
            this.type  = type;
            this.value = value;

            if (value != null)
            {
                this.type = value.GetType();
            }
            else
            {
                this.type = typeof(void);
            }

            // MS seems to convert arrays into a ReadOnlyCollection
            if (value is Array)
            {
                Array a = (Array)value;

                Type etype = a.GetType().GetElementType();
                CustomAttributeTypedArgumentMirror[] new_value = new CustomAttributeTypedArgumentMirror [a.GetLength(0)];
                for (int i = 0; i < new_value.Length; ++i)
                {
                    new_value [i] = new CustomAttributeTypedArgumentMirror(etype, a.GetValue(i));
                }
                this.value = new ReadOnlyCollection <CustomAttributeTypedArgumentMirror> (new_value);
            }
        }
コード例 #2
0
 internal CustomAttributeNamedArgumentMirror(PropertyInfoMirror prop, FieldInfoMirror field, CustomAttributeTypedArgumentMirror arg)
 {
     this.arg   = arg;
     this.prop  = prop;
     this.field = field;
 }