// ----------------------------------------------------------------------- // // Copyright 2014 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex { using System; using System.Collections.Generic; public static class ServiceLocator { private static Dictionary> services = new Dictionary>(); public static T Get() { return (T)services[typeof(T)](); } public static void Register(Func func) { services.Add(typeof(T), () => (object)func()); } } }