mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-22 02:07:45 +01:00
20 lines
450 B
C#
20 lines
450 B
C#
using System;
|
|
using System.Reflection;
|
|
|
|
namespace WireMock.Extensions;
|
|
|
|
internal static class EnumExtensions
|
|
{
|
|
public static string GetFullyQualifiedEnumValue<T>(this T enumValue)
|
|
where T : struct, IConvertible
|
|
{
|
|
var type = typeof(T);
|
|
|
|
if (!type.GetTypeInfo().IsEnum)
|
|
{
|
|
throw new ArgumentException("T must be an enum");
|
|
}
|
|
|
|
return $"{type.Namespace}.{type.Name}.{enumValue}";
|
|
}
|
|
} |