2 // Mono.ILASM.CustomAttr
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
12 using System.Collections;
14 namespace Mono.ILASM {
16 public interface ICustomAttrTarget {
17 void AddCustomAttribute (CustomAttr customattr);
20 public class CustomAttr {
22 private BaseMethodRef method_ref;
23 PEAPI.Constant constant;
24 public CustomAttr (BaseMethodRef method_ref, PEAPI.Constant constant)
26 this.method_ref = method_ref;
27 this.constant = constant;
30 public void AddTo (CodeGen code_gen, PEAPI.MetaDataElement elem)
32 method_ref.Resolve (code_gen);
33 code_gen.PEFile.AddCustomAttribute (method_ref.PeapiMethod, constant, elem);
36 public bool IsSuppressUnmanaged (CodeGen codegen)
40 BaseTypeRef owner = method_ref.Owner;
44 ExternTypeRef etr = owner as ExternTypeRef;
46 ExternAssembly ea = etr.ExternRef as ExternAssembly;
51 return (owner.FullName == "System.Security.SuppressUnmanagedCodeSecurityAttribute"
52 && (asmname == "mscorlib" || codegen.IsThisAssembly ("mscorlib")) );