Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- class ServiceLocator
- {
- private Dictionary<Type,object> bindings = new Dictionary<Type,object>();
- public void Bind<T>(T implementation)
- {
- bindings[typeof(T)] = implementation;
- }
- public T Resolve<T>()
- {
- return bindings[typeof(T)];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment