我试图使用 Fclp 解析参数,但遇到以下错误:
你有什么想法是什么原因导致这个错误?我在控制台中传递的参数是 -D 5。System.InvalidCastException:“无法将类型为'System.Reflection.RtFieldInfo'的对象强制转换为类型'System.Reflection.PropertyInfo'。”
class Program
{
public class ApplicationArguments
{
public int TenantId;
public int Days;
}
static void Main(string[] args)
{
var p = new FluentCommandLineParser<ApplicationArguments>();
p.Setup(arg => arg.TenantId)
.As('T', "tenantid");
p.Setup(arg => arg.Days)
.As('D', "days")
.Required();
var result = p.Parse(args);
}