namespace NBConfigBuilder;

public sealed partial class StringDictionaryConfig
{
    public Dictionary<int, string> Dic;
    public string this[int key] => GetValue(key);

    public bool TryGetValue(int key, out string value)
    {
        value = default;

        if (!Dic.ContainsKey(key))
        {
            return false;
        }

        value = Dic[key];
        return true;
    }

    private string GetValue(int key)
    {
        return Dic.TryGetValue(key, out var value) ? value : null;
    }
}