[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public abstract class TestAttributeBase : Attribute
public class TestAttribute : TestAttributeBase
public string Value {get; private set;}
public TestAttribute(string value)
public static void Main()
var customAttributes = typeof(B).GetCustomAttributes<TestAttribute>(true).ToList();
Console.WriteLine(customAttributes.Count);