internal override IList <CustomAttributeData> GetCustomAttributesData(Type attributeType) { List <CustomAttributeData> list = module.GetCustomAttributes(this.MetadataToken, attributeType); if ((this.Attributes & FieldAttributes.HasFieldMarshal) != 0 && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_MarshalAsAttribute))) { list.Add(MarshalSpec.GetMarshalAsAttribute(module, this.MetadataToken)); } if (declaringType.IsExplicitLayout && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_FieldOffsetAttribute))) { int rid = index + 1; // TODO use binary search? for (int i = 0; i < module.FieldLayout.records.Length; i++) { if (module.FieldLayout.records[i].Field == rid) { ConstructorInfo constructor = module.universe.System_Runtime_InteropServices_FieldOffsetAttribute.GetConstructor(new Type[] { module.universe.System_Int32 }); list.Add(new CustomAttributeData(constructor, new object[] { module.FieldLayout.records[i].Offset }, null)); break; } } } return(list); }
internal override IList <CustomAttributeData> GetInterfaceImplCustomAttributes(Type interfaceType, Type attributeType) { foreach (int i in module.InterfaceImpl.Filter(this.MetadataToken)) { if (module.ResolveType(module.InterfaceImpl.records[i].Interface, this) == interfaceType) { return(module.GetCustomAttributes((InterfaceImplTable.Index << 24) | (i + 1), attributeType)); } } return(Empty <CustomAttributeData> .Array); }
internal override IList <CustomAttributeData> GetCustomAttributesData(Type attributeType) { List <CustomAttributeData> list = module.GetCustomAttributes(this.MetadataToken, attributeType); if ((this.Attributes & MethodAttributes.PinvokeImpl) != 0 && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_DllImportAttribute))) { CreateDllImportPseudoCustomAttribute(list); } return(list); }
internal override IList <CustomAttributeData> GetInterfaceImplCustomAttributes(Type interfaceType, Type attributeType) { int token = this.MetadataToken; // TODO use binary search? for (int i = 0; i < module.InterfaceImpl.records.Length; i++) { if (module.InterfaceImpl.records[i].Class == token && module.ResolveType(module.InterfaceImpl.records[i].Interface, this) == interfaceType) { return(module.GetCustomAttributes((InterfaceImplTable.Index << 24) | (i + 1), attributeType)); } } return(Empty <CustomAttributeData> .Array); }
internal override IList <CustomAttributeData> GetCustomAttributesData(Type attributeType) { List <CustomAttributeData> list = module.GetCustomAttributes(this.MetadataToken, attributeType); if ((this.Attributes & FieldAttributes.HasFieldMarshal) != 0 && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_MarshalAsAttribute))) { list.Add(MarshalSpec.GetMarshalAsAttribute(module, this.MetadataToken)); } if (declaringType.IsExplicitLayout && (attributeType == null || attributeType.IsAssignableFrom(module.universe.System_Runtime_InteropServices_FieldOffsetAttribute))) { foreach (int i in module.FieldLayout.Filter(index + 1)) { ConstructorInfo constructor = module.universe.System_Runtime_InteropServices_FieldOffsetAttribute.GetPseudoCustomAttributeConstructor(module.universe.System_Int32); list.Add(new CustomAttributeData(module, constructor, new object[] { module.FieldLayout.records[i].Offset }, null)); break; } } return(list); }
internal override IList <CustomAttributeData> GetCustomAttributesData(Type attributeType) { return(manifestModule.GetCustomAttributes(0x20000001, attributeType)); }