JenkinsFile
This commit is contained in:
18
GeradoresService/Utils.cs
Normal file
18
GeradoresService/Utils.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
public static class EnumHelper
|
||||
{
|
||||
public static List<(T Value, string Description)> GetEnumValuesAndDescriptions<T>() where T : Enum
|
||||
{
|
||||
return typeof(T).GetFields()
|
||||
.Select(field => (
|
||||
Value: (T)field.GetValue(null),
|
||||
Description: field.GetCustomAttribute<DescriptionAttribute>()?.Description ?? field.Name
|
||||
))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user