using System.Collections.Generic; namespace RGB.NET.Core { /// /// Represents a set of custom data, each indexed by a string-key. /// public class CustomUpdateData { #region Properties & Fields private Dictionary _data = new Dictionary(); #endregion #region Indexer /// /// Gets or sets the value for a specific key. /// /// The key of the value. /// The value represented by the given key. public object this[string key] { get => _data.TryGetValue(key?.ToUpperInvariant() ?? string.Empty, out object data) ? data : default; set => _data[key?.ToUpperInvariant() ?? string.Empty] = value; } #endregion #region Constructors /// /// Initializes a new instance of the class. /// public CustomUpdateData() { } /// /// Initializes a new instance of the class. /// /// A params-list of tuples containing the key (string) and the value of a specific custom-data. public CustomUpdateData(params (string key, object value)[] values) { foreach ((string key, object value) in values) this[key] = value; } #endregion } }