Why doesn't C# allow generic types to be used as attributes inside the generic class?

asked6 years ago
last updated6 years ago
viewed201 times
Up Vote11Down Vote

This isn't a very important question, I'm only curious why it's not allowed. The error message is not helpful in explaining, because obviously 'Att' inherit from Attribute.

public class Generic<Att> where Att : System.Attribute
{
    [Att] //Error: 'Att' is not an attribute class
    public float number;
}