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();
#endregion
#region Indexer
///
/// Gets or sets the value for a specific key.
///
/// The key of the value.
/// The value represented by the specified key.
public object? this[string key]
{
get => _data.TryGetValue(key.ToUpperInvariant(), out object? data) ? data : default;
set => _data[key.ToUpperInvariant()] = 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
}