Import from internal git
This commit is contained in:
15
Core/Helpers/EnumHelper.cs
Normal file
15
Core/Helpers/EnumHelper.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user