public static void Main()
var handler = WorkflowEventHandler.CONSECUTIVE_CASE_CREATED;
var attribute = typeof(WorkflowEventHandler)
.GetField(handler.ToString())
.GetCustomAttributes(typeof(WorkflowEventHandlerMapAttribute), false)
.FirstOrDefault() as WorkflowEventHandlerMapAttribute;
Console.WriteLine(attribute.MapTo);
enum WorkflowEventHandler
[WorkflowEventHandlerMap(typeof(ConsecutiveCaseCreated))]
CONSECUTIVE_CASE_CREATED = 1,
[WorkflowEventHandlerMap(typeof(ConsecutiveCaseCancelled))]
CONSECUTIVE_CASE_CANCELLED = 2,
[WorkflowEventHandlerMap(typeof(ConsecutiveCaseModified))]
CONSECUTIVE_CASE_MODIFIED = 3,
[WorkflowEventHandlerMap(typeof(IntermittentCaseCreated))]
INTERMITTENT_CASE_CREATED = 4,
[WorkflowEventHandlerMap(typeof(IntermittentCaseTimeAdjusted))]
INTERMITTENT_CASE_TIME_ADJUSTED = 5,
[WorkflowEventHandlerMap(typeof(IntermittentCaseTimeDeleted))]
INTERMITTENT_CASE_TIME_DELETED = 6,
[WorkflowEventHandlerMap(typeof(CaseChangedType))]
[AttributeUsage(AttributeTargets.Field)]
class WorkflowEventHandlerMapAttribute: Attribute
public Type MapTo { get; init; }
public WorkflowEventHandlerMapAttribute(Type mapTo) => MapTo = mapTo;
class ConsecutiveCaseCreated { }
class ConsecutiveCaseCancelled { }
class ConsecutiveCaseModified { }
class IntermittentCaseCreated { }
class IntermittentCaseTimeAdjusted { }
class IntermittentCaseTimeDeleted { }
class CaseChangedType { }