using System; using System.Collections.Generic; namespace WalletConnectSharp.Core.Events { public class EventFactory { private static EventFactory _instance; private Dictionary _eventProviders = new Dictionary(); public static EventFactory Instance { get { if (_instance == null) { _instance = new EventFactory(); } return _instance; } } public void Register(IEventProvider provider) { Type t = typeof(T); if (_eventProviders.ContainsKey(t)) return; _eventProviders.Add(t, provider); } public IEventProvider ProviderFor() { Type t = typeof(T); if (_eventProviders.ContainsKey(t)) return _eventProviders[t]; return null; } } }