2016-01-22 35 views

回答

2

顯然你所要做的就是將返回類型聲明爲int類型。此示例在文檔中:

[Option("l", "lenght", HelpText = "The maximum number of bytes to process.")] 
    public int MaximumLenght { get; set; }; 
// ... 
} 

The following will be accepted. 
    GuideApp --lenght=99 
    GuideApp -l12345 
    GuideApp -l 555 
The following will be rejected. 
    GuideApp --lenght=a-string 
    GuideApp -lsome_text 
    GuideApp -l text.again 
+0

謝謝!這正是我一直在尋找的:) –