public static Context GetInstance(ContextType type) { lock (typeof (Context)) { Context ctx; if (!instances.TryGetValue (type, out ctx)) { ctx = new Context (type); instances.Add (type, ctx); } return ctx; } }