public T GetService <T>() { if (InitialisedServices.ContainsKey(typeof(T))) { return((T)InitialisedServices[typeof(T)]); } throw new KeyNotFoundException(); }
public bool RegisterServiceObject <T>(T service, bool overwriteIfExists = false) { lock (InitialisedServices) { if (!InitialisedServices.ContainsKey(typeof(T))) { InitialisedServices.Add(typeof(T), service); return(true); } else if (overwriteIfExists) { InitialisedServices[typeof(T)] = service; return(true); } return(false); } }