using System.Reflection;
using MycroForge.Core.Attributes;
namespace MycroForge.Core.Extensions;
public static class EnumExtensions
{
///
/// A generic extension method that aids in reflecting
/// and retrieving any attribute that is applied to an `Enum`.
///
public static string ToDockerPlatformString(this ProjectConfig.DbConfig.DbuPlatformOptions value)
{
return value.GetType()
.GetMember(value.ToString())
.FirstOrDefault()!
.GetCustomAttribute()!.Platform;
}
}