I'm not positive if the title of the thread is accurate.
I have a class of different enums:
public class Enums
{
    public enum StringActions 
    {  
        FIRSTNAME, 
        MIDDLEINITIAL, 
        LASTNAME
    }
    public enum IntegerAction
    {
        RANGE,
        RANDOM
    }
}
I have an object who's constructor, I'd like to take in a generic Enums parameter, which would be capable of accepting either a StringAction or a IntegerAction. I have dictionaries (one for each enum type) that has these enums as the keys, and delegates as values. I want to use the passed in enum to lookup the correct delegate for that enum and then do some work with it.
public class DataPoint
{
    public DataPoint(Enum mAction)
    {
        if (mAction == Enums.StringAction)
        { 
             var act = StringActionDictionary[mAction];
        }
        else if (mAction == Enums.IntegerAction)
        {
             var act = IntegerActionDictionary[mAction];
        }
        ...
    }
 }
With this implementation, I'll need to cast 'mAction' to the correct type but how can that be accomplished at runtime? Is reflection an option here, or is there another way?
 
    
