DictionaryPoolComponent.cs 475 B

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