Interface with Dictionary and enum

Is it possible to use a generic enum type when creating an interface? Something like…

public IListener
{
void OnValueChanged(Dictionary<enum,Color> dictionary);
}

Or would you have to use an existing enum that’s already defined somewhere? Would a simple public enum work for this?

I would like to pass a dictionary as an argument for the method with enums as keys, but unsure how to go about it. Any insight would be appreciated, thanks.

I was eventually able to get this to work, I had forgotten that pesky dot operator when trying to use a public enum. IE

public IListener
{
void OnValueChanged(Dictionary<Themes.ColorKeys,Color> dictionary);
}

All works fine this way. Hope this is helpful to somebody else with the same issue.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms