コード例 #1
0
 public Func <T> Create(SimpleContainer container)
 {
     return(() => (T)container.GetInstance(typeof(T), null));
 }
コード例 #2
0
 /// <summary>
 /// Requests an instance.
 /// </summary>
 /// <typeparam name="TService">The type of the service.</typeparam>
 /// <param name="container">The container.</param>
 /// <param name="key">The key.</param>
 /// <returns>The instance.</returns>
 public static TService GetInstance <TService>(this SimpleContainer container, string key = null)
 {
     return((TService)container.GetInstance(typeof(TService), key));
 }