Aetheria/Assets/Scripts/ServerShared/EnumDictionary.cs
Reinier Vens 968783bf9c Database Improvements
Brought in all the myriad improvements to the database tools from the Stream Pixels project
Added configurable nested entry grouping
2021-04-07 01:27:35 +01:00

16 lines
No EOL
381 B
C#

using System;
using MessagePack;
using Newtonsoft.Json;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class EnumDictionary<E, T> where E : Enum
{
[JsonProperty("values"), Key(0)] public T[] Values;
public EnumDictionary()
{
Values = new T[Enum.GetNames(typeof(E)).Length];
}
public T this[E key] => Values[Convert.ToInt32(key)];
}