commandlineparser/commandline

Enum with 0 value not shown on Example

Open

#379 建立於 2018年12月7日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)C# (4,280 star) (461 fork)batch import
buggood first issue

描述

public class MyOption { [Option('t', "type", Required = true, HelpText = "My entity")] public EntityType MyEntityType { get; set; } public enum MyEntityType { X0, // Example for X0 is empty. If change this line to X0 =1, everything is ok X1, X2 }

    [Usage(ApplicationAlias = "...")]
    public static IEnumerable<Example> Examples
    {
        get
        {
            foreach (EntityType entityType in Enum.GetValues(typeof(EntityType)))
            {
                yield return new Example(entityType.ToString(), new MyOption { MyEntityType = entityType});
            }
        }
    }
}

貢獻者指南