ViIvanov

C# Bug: Attribute with nullable parameter and default value

Nov 8th, 2013
283
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // CSC : error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
  2.  
  3. using System;
  4.  
  5. [AttributeUsage(AttributeTargets.All)]
  6. class MyAttribute : Attribute
  7. {
  8.   public MyAttribute(int? value = null) { }
  9. }
  10.  
  11. [My]
  12. class Program
  13. {
  14.   static void Main() { }
  15. }
RAW Paste Data