-
Notifications
You must be signed in to change notification settings - Fork 30
EnumeratedValueArgument w/ Enum #56
Copy link
Copy link
Closed
Description
At a glance, I'm not seeing a method of using an enum along with EnumeratedValueArgument, specifically when using a attribute style parsing target.
I was hoping for something like:
public enum MyEnum
{
One,
Two
}
[EnumeratedValueArgument(typeof(MyEnum), 'm', "myEnum")]
public MyEnum ParsedEnum;
or perhaps:
public enum MyEnum
{
One,
Two
}
public static Dictionary<MyEnum, string> EnumMapping = new Dictionary<MyEnum, string>()
{
{ MyEnum.One, "do something with one" },
{ MyEnum.Two, "do something with two" },
};
[EnumeratedValueArgument(typeof(string), 'm', "myEnum", AllowedValues = string.Join(";", EnumMapping.Keys)]
public string ParsedEnum;
but that gives:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
any ideas on this sort of functionality?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels