title: Get class DisplayName attribute value
body: <p>Iv'e spent the last hour trying to get the value of a <code>DisplayName</code> attribute that's applied to a <code>Class</code>.</p>
  
  <p>I find it simple enough to get the attribute values from methods and properties but I'm struggling with the class.</p>
  
  <p>Could anyone help me out with this relatively small issue?</p>
  
  <p>Sample below:</p>
  
  <p>The Class</p>
  
  <pre><code> [DisplayName("Opportunity")]
   public class Opportunity
   {
    // Code Omitted
   }
  </code></pre>
  
  <p>The Variable</p>
  
  <pre><code>var classDisplayName = typeof(T).GetCustomAttributes(typeof(DisplayNameAttribute),true).FirstOrDefault().ToString();
  </code></pre>
  
  <p>I have spent much time on MSDN and SO but I guess I'm missing something stupidly simple.</p>
  
  <p>Either way great question for future readers too</p>
  
  <p>Any help greatly appreciated!</p>