using System.Collections.Concurrent; namespace zero.Utils; public class PrimitiveTypeCollection : ConcurrentDictionary, IPrimitiveTypeCollection { /// /// Initializes a new instance of . /// public PrimitiveTypeCollection() { } /// public TValue Get() => (TValue)this[typeof(TValue)]; /// public void Set(TValue instance) => this[typeof(TValue)] = instance; /// public void Remove() => TryRemove(typeof(TValue), out _); } /// /// Represents a simple collection based on type. /// public interface IPrimitiveTypeCollection : ICollection> { /// /// Retrieves the requested value from the collection. /// /// The value key. /// The requested value, or null if it is not present. TValue Get(); /// /// Sets the given value in the collection. /// /// The value key. /// The value value. void Set(TValue instance); /// /// Removes the given value from the collection. /// /// The value key. /// The value value. void Remove(); }