I use custom attributes to bind metadata to class methods. At run time, these attributes and their parameters are checked. Is there a consensus on which existing exception class should be implemented if an attribute (or attribute parameter) is invalid?
For example, if an attribute takes an instance method name as its constructor parameter:
public class StateAttribute : Attribute {
public string ParentState { get; set; }
public StateAttribute() {}
}
when used in a class, for example:
public StateMachine {
[State]
public Result TopState(Event e) { ... }
[State( ParentState = "TopState" )]
public Result NestedState(Event e) { ... }
}
, State, ParentState MethodInfo. (, - ) , . , ?
, , ?