commandlineparser / commandlineparser/commandline

Option Default type conversion

未关闭
#740 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
4.8k
派生
478
PR 合并指标
30 天内没有已合并 PR

描述

Hi,
I'm wondering why the `Default` property of `OptionAttribute` is of type `object`. This makes it rather hard to have defaults for reference types as it has to be compile-time constant. Wouldn't it be better to have the `Default` property of type `string` and use the same conversion that is in place when the actual command line argument is parsed?

For example I'd like to have option of type `CultureInfo` with default value `en-US`, now it is not possible to have this default specified through attribute (I have to assign in in constructor of the option class)

Another quite elegant solution is adding `DefaultProperty` property to `OptionAttribute` that will specify name of property returning actual default value, this has been mentioned in issue #530 and similar to #191

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。