Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does DefaultValue *always* overwrite the property if that option is not provided? #81

Open
nemec opened this issue Apr 12, 2013 · 1 comment

Comments

@nemec
Copy link
Collaborator

nemec commented Apr 12, 2013

I would expect the default value to not be used unless the option was provided but without a value. Otherwise, it kind of duplicates the functionality of the constructor (but more limited since Attributes may only contain constant values).

For example, when parsing the following class:

public class Config
{
    [Option('v', DefaultValue = "Other")]
    public string Value { get; set; }

    public Config()
    {
        Value = "Initial";
    }
}

I would expect the following:

  • Program.exe > Value == Initial
  • Program.exe -v > Value == Other
  • Program.exe -v Overwrite > Value == Overwrite
@gsscoder
Copy link
Owner

@nemec, this is correct.

This is the current behaviour of still unpublished kernel 2.0.

Hope to push a pre-release before the end of the month.

Giacomo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants