commandlineparser / commandlineparser/commandline
Option Default type conversion
- Linguagem predominante
- C#
- Estrelas
- 4.8k
- Forks
- 478
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Localize OptionAttribute e o caminho de conversão existente dos argumentos de linha de comando. Compare as abordagens propostas string Default e DefaultProperty, incluindo seus efeitos sobre valores padrão de tipos de referência, como CultureInfo. A conclusão exige uma direção de API definida e cobertura para a conversão de um valor padrão especificado por um atributo.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp
- Domínio
- cli
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100