Files
CliFx/CliFx/Extensibility/EnumBindingConverter.cs
Tyrrrz f7645afbdb asd
2024-08-11 01:44:40 +03:00

15 lines
403 B
C#

using System;
namespace CliFx.Extensibility;
/// <summary>
/// Converter for binding inputs to properties of type <see cref="Enum" />.
/// </summary>
public class EnumBindingConverter<T> : BindingConverter<T>
where T : struct, Enum
{
/// <inheritdoc />
public override T Convert(string? rawValue, IFormatProvider? formatProvider) =>
(T)Enum.Parse(typeof(T), rawValue!, true);
}