title: How to get Attribute Value in C# for the class property
body: <pre><code> [System.AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
      sealed class ColumnName : Attribute
      {
          // See the attribute guidelines at 
          //  http://go.microsoft.com/fwlink/?LinkId=85236
  
          readonly string Column;
  
          // This is a positional argument
          public ColumnName(string columnName)
          {
              this.Column = columnName;
          }
      }
  
      public class Comment
      {
          [ColumnName("ID1")]
          public int Id;
          [ColumnName("NAME1")]
          public string Name;
          [ColumnName("TEST1")]
          public string Test;
      }
  </code></pre>
  
  <p>In this code you can see I have create a class comment which have an attribute ColumnName. ColumnName is my custom class which I used to define the attirubte.</p>
  
  <p>Now I am looking for a sollution to find the ColumnName value for all the properties.</p>
  
  <pre><code>public static List&lt;T&gt; ExecuteReader&lt;T&gt;(string str)
          {
              var res = typeof(T);
  
              return new List&lt;T&gt;();
          }
  </code></pre>
  
  <p>I tried run some Stack Overflow code on my issue but it doesn't work well. What thing I am missing in my code?</p>