j-maly / CommandLineParser

Command line parser. Declarative arguments support. Rich set of argument types (switches, enums, files, etc...). Mutually exclusive arguments validations.
MIT License
137 stars 30 forks source link

Add support to native Guid type #47

Closed delfuria closed 7 years ago

delfuria commented 7 years ago

Hi, i have tried to fork your project for make a PR but since you have used the new 2017 VS format i'm not able to do that. So i ask you, if possible to add support to guid type simply adding a single line of code to the file

ValueArgument.cs

On method

protected virtual TValue DefaultConvert(string stringValue)

you have a lot of "if" statement for manage the native type and if you add this line of code

           if (valueType == typeof(Guid)) return (TValue)(object)Guid.Parse(stringValue);

just below the last if all works fine. Thanks in advance

j-maly commented 7 years ago

Added in 3.0.13. Guid.Parse is not available in all versions of .NET, but I've added some ifdefs around that..

delfuria commented 7 years ago

Thanks a lot