using System; using System.Collections.Generic; namespace Discord.Serialization { public class ModelMap { private readonly List _propList; private readonly BufferDictionary _propDict; public string Path { get; } public bool HasDynamics { get; } public IReadOnlyList Properties => _propList; internal ModelMap(string path) { Path = path; _propList = new List(); _propDict = new BufferDictionary(); } internal void AddProperty(PropertyMap propMap) { _propList.Add(propMap); _propDict.Add(propMap.Utf8Key, propMap); } public bool TryGetProperty(ReadOnlyBuffer key, out PropertyMap value) => _propDict.TryGetValue(key, out value); public bool TryGetProperty(ReadOnlySpan key, out PropertyMap value) => _propDict.TryGetValue(key, out value); } }