mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
15 lines
472 B
C#
15 lines
472 B
C#
using System;
|
|
|
|
namespace CliFx.Extensibility;
|
|
|
|
/// <summary>
|
|
/// Converter for binding command inputs to properties whose types implement <see cref="IConvertible" />.
|
|
/// </summary>
|
|
public class ConvertibleBindingConverter<T> : BindingConverter<T>
|
|
where T : IConvertible
|
|
{
|
|
/// <inheritdoc />
|
|
public override T? Convert(string? rawArgument, IFormatProvider? formatProvider) =>
|
|
(T?)System.Convert.ChangeType(rawArgument, typeof(T), formatProvider);
|
|
}
|