Accessing and caching attributes
Let’s define an extension method on Type:

public static class AttributeCache
{
    public static IEnumerable&lt;T&gt; Attributes&lt;T&gt;(this Type type)
        where T : Attribute =&gt; Cache
            .GetOrAdd(type, t =&gt; t.GetCustomAttributes(true).OfType&lt;Attribute&gt;().ToArray())
            .OfType&lt;T&gt;();        

    static ConcurrentDictionary&lt;Type, Attribute[]&gt; Cache { get; } = 
        new ConcurrentDictionary&lt;Type, Attribute[]&gt;();
}


Demo:

foreach (var a in typeof(MyCass).Attributes&lt;TestAttribute&gt;())
    Console.WriteLine(a.MyProp);