Ist es möglich, das Vorhandensein eines Attributs innerhalb des Codes eines anderen Attributs zu testen?Test für Attribute aus dem Code anderer Attribute
Sagen Sie bitte die folgende Klassendefinition haben:
public class Inception {
[Required]
[MyTest]
public int Levels { get; set; }
}
public class MyTestAttribute : ValidationAttribute {
public override bool IsValid(object o){
// return whether the property on which this attribute
// is applied also has the RequiredAttribute
}
}
... ist es möglich, MyTestAttribute.IsValid zu bestimmen, ob Inception.Levels die RequiredAttribute hat?
Ooooh! Gute! Ich vermute nein, aber es ist nur eine Vermutung. – zmbq