16 lines
475 B
C#
16 lines
475 B
C#
using System;
|
|
using UnityEngine.TestTools;
|
|
|
|
namespace BracerLib.Utility
|
|
{
|
|
[ExcludeFromCoverage]
|
|
public static class EnumUtility
|
|
{
|
|
public static T GetValue<T>(int index) where T : IConvertible => (T)Enum.ToObject(typeof(T), index);
|
|
|
|
public static T GetValue<T>(string value) where T : IConvertible => (T)Enum.Parse(typeof(T), value, true);
|
|
|
|
public static T[] GetValues<T>() where T : IConvertible => (T[])Enum.GetValues(typeof(T));
|
|
}
|
|
}
|