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 key = coreAssociations.Single(p => p.Value == entryPoint).Key; coreAssociations.Remove(key); } } }