J'ai deux attributs personnalisés définis comme ceci:Est-ce que la restriction d'attributs à la classe ou aux propriétés est réalisable?
internal class SchemaAttribute : Attribute {
internal SchemaAttribute(string schema) {
Schema = schema;
}
internal string Schema { get; private set; }
}
internal class AttributeAttribute : Attribute {
internal AttributeAttribute(string attribute) {
Attribute = attribute;
}
internal string Attribute { get; private set; }
}
Je voudrais limiter la SchemaAttribute aux classes, et la AttributeAttribute aux propriétés.
Est-ce faisable?
Si vous trouvez ma question si assez bon pour aider quelqu'un d'autre, s'il vous plaît upvote. Merci! =) –