StaticEnumeration does not combine with list values
Reyhn3 opened this issue · comments
Using Static Enumerations work fine for distinct values, but they don't work with list values.
Argument -c value "Red" cannot be converted to the required type System.Collections.Generic.IList
1[StaticEnumerationList.ColorEnum].`
I would like to be able to do something like this:
internal class Program
{
private static void Main(string[] args)
{
var options = CliParser.StrictParse<Options>(args);
foreach (var color in options.Colors)
Console.WriteLine("Color: {0}", color);
Console.ReadLine();
}
}
internal class Options
{
[NamedArgument('c', "colors", Action = ParseAction.Append, Constraint = NumArgsConstraint.AtLeast, Const = 1)]
public IList<ColorEnum> Colors { get; set; }
}
public enum Color
{
Red,
Green,
Blue
}
[StaticEnumeration]
internal abstract class ColorEnum
{
public static readonly ColorEnum Red = new EnumValue(Color.Red);
public class EnumValue : ColorEnum
{
public EnumValue(Color value)
{
Value = value;
}
public Color Value { get; private set; }
}
}