Becase we can't use generic type attributes, are there any substitute solutions? Maybe an example is helpful to discuss:
public abstract class ErrorHandler { }
public class AccessHandler : ErrorHandler { }
public class ConnectionHandler : ErrorHandler { }
public class OtherHandler : ErrorHandler { }
public class CoHandler<T> : Attribute where T : ErrorHandler
{
public T GetHandler()
{
return default(T); // just an example
}
}
public enum Errors
{
[CoHandler<AccessHandler>()]
Access,
[CoHandler<ConnectionHandler>()]
Connection,
[CoHandler<OtherHandler>()]
Other
}