commandlineparser / commandlineparser/commandline
Option Default type conversion
- Lenguaje dominante
- C#
- Estrellas
- 4.8k
- Forks
- 478
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Localizar OptionAttribute y la ruta de conversión existente de los argumentos de la línea de comandos. Comparar los enfoques propuestos de string Default y DefaultProperty, incluidos sus efectos sobre los valores predeterminados de tipos de referencia como CultureInfo. Se requiere tener una dirección de API decidida y cobertura para la conversión de un valor predeterminado especificado por un atributo.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp
- Área
- cli
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100