Пример #1
0
 /// <summary>
 /// This constructor can be used for objects that implement IDisposable.
 /// </summary>
 /// <param name="createCallback">The wrapper to call to create the object.</param>
 public WrapperCollection(CreateWrapper createCallback)
 {
     if (typeof(T).GetInterface(DISPOSABLE_INTERFACE_NAME) != null)
     {
         this.createCallback  = createCallback;
         this.destroyCallback = disposableDelete;
     }
     else
     {
         throw new Exception("Tried to create a WrapperCollection for type {0} that is not IDisposable. Please explicitly defind a destroyCallback and use the other constructor for this type.");
     }
 }
Пример #2
0
 /// <summary>
 /// This constructor can be used for objects that need a custom destroy method.
 /// </summary>
 /// <param name="createCallback">The function to call to create the object.</param>
 /// <param name="destroyCallback">The function to call to destroy the object.</param>
 public WrapperCollection(CreateWrapper createCallback, DestroyWrapper destroyCallback)
 {
     this.createCallback  = createCallback;
     this.destroyCallback = destroyCallback;
 }