-
-
Notifications
You must be signed in to change notification settings - Fork 254
/
IValueParser.cs
29 lines (26 loc) · 1.08 KB
/
IValueParser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) Nate McMaster.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Globalization;
namespace McMaster.Extensions.CommandLineUtils.Abstractions
{
/// <summary>
/// A parser that can convert string into an object.
/// </summary>
public interface IValueParser
{
/// <summary>
/// Gets the Type that this value parser is defined for.
/// </summary>
Type TargetType { get; }
/// <summary>
/// Parses the raw string value.
/// </summary>
/// <param name="argName">The name of the argument this value will be bound to.</param>
/// <param name="value">The raw string value to parse.</param>
/// <param name="culture">The culture that should be used to parse values.</param>
/// <returns>The parsed value object.</returns>
/// <throws name="System.FormatException">When the value cannot be parsed.</throws>
object? Parse(string? argName, string? value, CultureInfo culture);
}
}