title: C# Custom Attribute parameters
body: <p>I saw this answer from this link <a href="https://stackoverflow.com/questions/270187/can-i-initialize-a-c-sharp-attribute-with-an-array-or-other-variable-number-of-a">Adding parameters to custom attributes</a> of how is to add parameters on Custom Attribute </p>
  
  <pre><code>class MyCustomAttribute : Attribute {
      public int[] Values { get; set; }
  
      public MyCustomAttribute(params int[] values) {
         this.Values = values;
      }
  }
  
  [MyCustomAttribute(3, 4, 5)]
  class MyClass { }
  </code></pre>
  
  <p>Now I am wondering if can't it be write like this?</p>
  
  <pre><code>class MyCustomAttribute : Attribute {
      private int[] _values;
  
      public MyCustomAttribute(params int[] values) {
         _values = values;
      }
  }
  
  [MyCustomAttribute(3, 4, 5)]
  class MyClass { }
  </code></pre>
  
  <p>I changed the property Values into a variable _values.
  I also made it private and it works fine when I tried it.</p>
  
  <p>Can someone enlighten me why the accepted answer is valid?</p>