title: How do I add a custom attribute without a default constructor using mono.cecil
body: <p>This question is related to <a href="https://stackoverflow.com/questions/8388196/adding-custom-attributes-using-mono-cecil">this one</a>, but is not a duplicate. Jb posted there that to add a custom attribute, the following snippet would work:</p>
  
  <pre><code>ModuleDefinition module = ...;
  MethodDefinition targetMethod = ...;
  MethodReference attributeConstructor = module.Import(
      typeof(DebuggerHiddenAttribute).GetConstructor(Type.EmptyTypes));
  
  targetMethod.CustomAttributes.Add(new CustomAttribute(attributeConstructor));
  module.Write(...);
  </code></pre>
  
  <p>I would like to use something similar, but to add a custom attribute whose constructor takes two string parameters in its (only) constructor, and I'd like to specify values for  those (obviously). Can anyone help?</p>