HashSetComponent.cs 433 B

12345678910111213141516171819
  1. using System;
  2. using System.Collections.Generic;
  3. namespace ET
  4. {
  5. public class HashSetComponent<T>: HashSet<T>, IDisposable
  6. {
  7. public static HashSetComponent<T> Create()
  8. {
  9. return ObjectPool.Instance.Fetch(typeof (HashSetComponent<T>)) as HashSetComponent<T>;
  10. }
  11. public void Dispose()
  12. {
  13. this.Clear();
  14. ObjectPool.Instance.Recycle(this);
  15. }
  16. }
  17. }