Skip to content

Commit 0ddb2b5

Browse files
committed
Made the ValueType property for Option as to expose the ValueType property for Argument.
1 parent b7f0d1c commit 0ddb2b5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/System.CommandLine/Option.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public ArgumentArity Arity
6262
/// </summary>
6363
public bool Recursive { get; set; }
6464

65+
/// <summary>
66+
/// Gets the <see cref="Type" /> that the option's parsed tokens will be converted to.
67+
/// </summary>
68+
public abstract Type ValueType { get; }
69+
6570
/// <summary>
6671
/// Validators that will be called when the option is matched by the parser.
6772
/// </summary>

src/System.CommandLine/Option{T}.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public Func<ArgumentResult, T>? DefaultValueFactory
4444

4545
internal sealed override Argument Argument => _argument;
4646

47+
/// <inheritdoc />
48+
public override Type ValueType => _argument.ValueType;
49+
4750
/// <summary>
4851
/// Configures the option to accept only the specified values, and to suggest them as command line completions.
4952
/// </summary>

0 commit comments

Comments
 (0)