Get ENUM value from Custom Attribute
<p>I have Enum and all have there custom attribute. So, i want Enum value through supplied custom attribute.</p>

<p><strong>ENUM</strong></p>

<pre><code>public enum Language
    {
        [StringValue("af")]
        Afrikaans,
        [StringValue("sq")]
        Albanian,
        [StringValue("ar")]
        Arabic,
        [StringValue("be")]
        Belarusian,
        [StringValue("bg")]
        Bulgarian,
        [StringValue("ca")]
        Catalan
}
</code></pre>

<p>I try to implement this code but i got error "<strong>'Type' does not contain a definition for 'GetTypeInfo' and no extension method 'GetTypeInfo' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)</strong>"</p>

<pre><code>using System.Reflection;

public static T GetAttribute&lt;T&gt;(this Enum enumValue)
        where T : Attribute
    {
        return enumValue
            .GetType()
            .GetTypeInfo()
            .GetDeclaredField(enumValue.ToString())
            .GetCustomAttribute&lt;T&gt;();
    }
</code></pre>