namespace Core { public class CoreInterface { private static readonly Dictionary coreAssociations = new Dictionary(); public T GetPlugin() where T : IProjectPlugin { return coreAssociations[this].GetPlugin(); } internal static void Associate(CoreInterface coreInterface, EntryPoint entryPoint) { coreAssociations.Add(coreInterface, entryPoint); } internal static void Desociate(EntryPoint entryPoint) { var keys = coreAssociations.Where(p => p.Value == entryPoint).ToArray(); if (keys.Length == 0) return; foreach (var key in keys) { coreAssociations.Remove(key.Key); } } } }