title: Nullable int in Attribute Constructor or Property
body: <p>So I have a custom attribute, let's call it <code>MyCustomAttribute</code>, which has a constructor like so:</p>
  
  <pre><code>public MyCustomAttribute(int? i)
  {
     // Code goes here
  }
  </code></pre>
  
  <p>and declares a property:</p>
  
  <pre><code>public int? DefaultProperty { get; set; }
  </code></pre>
  
  <p>Now if I wanted to use the property, I'd need to pass in an <code>int</code> or <code>null</code>, well that's what I'd expect.</p>
  
  <p>But this gives a compiler error:</p>
  
  <pre><code>[MyCustomAttribute(1, DefaultProperty = 1)]
  public int? MyProperty { get; set; }
  </code></pre>
  
  <p>and so does this:</p>
  
  <pre><code>[MyCustomAttribute(null,DefaultProperty = null)]
  public int? MyProperty { get; set; }
  </code></pre>
  
  <p>The error is: <code>An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type</code> for both the constructor and the property.</p>
  
  <p>Why is this? If I change the constructor to take an int, I can pass in <code>0</code>, but not <code>null</code>, which sort of defeats the purpose of the value (which can sometimes be null)</p>