Czy można przetestować istnienie atrybutu w kodzie innego atrybutu?Test atrybutów z kodu innych atrybutów
Powiedzmy, że masz następującą definicję klasy:
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
}
}
... czy to możliwe, aby ustalić, czy MyTestAttribute.IsValid Inception.Levels ma RequiredAttribute?
Ooooh! Dobry! Zgaduję, że nie, ale to tylko domysły. – zmbq