Initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user