コード例 #1
0
        void AppendCustomAttrs(IList <CustomAttributeDataMirror> attrs, TypeMirror type, bool inherit)
        {
#if ENABLE_CECIL
            if (cattrs == null && Metadata != null && !Metadata.HasCustomAttributes)
            {
                cattrs = new CustomAttributeDataMirror [0];
            }
#endif

            if (cattrs == null)
            {
                CattrInfo[] info = vm.conn.Type_GetCustomAttributes(id, 0, false);
                cattrs = CustomAttributeDataMirror.Create(vm, info);
            }

            foreach (var attr in cattrs)
            {
                if (type == null || attr.Constructor.DeclaringType == type)
                {
                    attrs.Add(attr);
                }
            }

            if (inherit && BaseType != null)
            {
                BaseType.AppendCustomAttrs(attrs, type, inherit);
            }
        }