commandlineparser / commandlineparser/commandline

Type conversions for DefaultValue property

Offen
#71 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
C#
Sterne
4.8k
Forks
478
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**Issue by [mylady](https://github.com/mylady)**
_Thursday May 05, 2016 at 16:40 GMT_
_Originally opened as https://github.com/gsscoder/commandline/issues/312_

----

hi,
i'm new to this libray and i followed instructions in the wiki
just do some simple test and i'm confused with the default value and metavalue
for example

``` c#
[Option('i', "ip", HelpText = "set remote server ip", DefaultValue = "127.0.0.1")]
public string RemoteIPAddress { set; get; }

[Option('r', "remote", HelpText = "set remote server port, tcp protocol like", DefaultValue = 8000u)]
public uint RemotePort { set; get; }
```

if i change type of RemoteIPAddress to IPAddress,there will be an exception report bad default value string can't be coverted to IPAddress,but for the attribute value ,IPAddress.Any or IPAddress.Loopback can't be set because they are static value

then as the type uint,if i set DefaultValue of RemotePort to 8000,it also cause exception that int can't be converted to uint even if i set MetaValue to "uint"

i dont't quite get it ,any help will be appreciated

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.