mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
20 lines
604 B
C#
20 lines
604 B
C#
using System;
|
|
|
|
namespace TOHE;
|
|
|
|
public static class EnumHelper
|
|
{
|
|
/// <summary>
|
|
/// Get all values of enum
|
|
/// </summary>
|
|
/// <typeparam name="T">Type of enum to be obtained</typeparam>
|
|
/// <returns>All values of T</returns>
|
|
public static T[] GetAllValues<T>() where T : Enum => Enum.GetValues(typeof(T)) as T[];
|
|
/// <summary>
|
|
/// Get all names of enum
|
|
/// </summary>
|
|
/// <typeparam name="T">Type of enum to be obtained</typeparam>
|
|
/// <returns>All values of T</returns>
|
|
public static string[] GetAllNames<T>() where T : Enum => Enum.GetNames(typeof(T));
|
|
}
|