15 lines
447 B
C#
15 lines
447 B
C#
namespace Core.Helpers;
|
|
|
|
public static class EnumHelper
|
|
{
|
|
/// <summary>
|
|
/// Retrieved maximum possible value in an enum. In other words, return the number of values contained in the enum
|
|
/// </summary>
|
|
/// <typeparam name="T">Enum</typeparam>
|
|
/// <returns>Number of possible values</returns>
|
|
public static int GetMaxValue<T>() where T : Enum
|
|
{
|
|
var i = Enum.GetValues(typeof(T)).Length;
|
|
return i;
|
|
}
|
|
} |