title: How to get Custom Attribute values for enums?
body: <p>I have an enum where each member has a custom attribute applied to it. How can I retrieve the value stored in each attribute?</p>
  
  <p>Right now I do this:</p>
  
  <pre><code>var attributes = typeof ( EffectType ).GetCustomAttributes ( false );
  foreach ( object attribute in attributes )
  {
      GPUShaderAttribute attr = ( GPUShaderAttribute ) attribute;
      if ( attr != null )
          return attr.GPUShader;
  }
  return 0;
  </code></pre>
  
  <p>Another issue is, if it's not found, what should I return? 0 is implcity convertible to any enum, right? That's why I returned that.</p>
  
  <p>Forgot to mention, the above code returns 0 for every enum member.</p>