void CopyTo(CustomAttribute target, ModuleDefinition context) { foreach (var arg in ConstructorArguments) target.ConstructorArguments.Add(new CustomAttributeArgument(context.Import(arg.Type), arg.Value)); foreach (var field in Fields) target.Fields.Add(new CustomAttributeNamedArgument(field.Name, new CustomAttributeArgument(context.Import(field.Argument.Type), field.Argument.Value))); foreach (var prop in Properties) target.Properties.Add(new CustomAttributeNamedArgument(prop.Name, new CustomAttributeArgument(context.Import(prop.Argument.Type), prop.Argument.Value))); }
internal static CustomAttribute Clone(CustomAttribute custattr, ModuleDefinition context) { var ca = new CustomAttribute(context.Import(custattr.Constructor)); custattr.CopyTo(ca, context); return ca; }