Pull up CategorizedPool. Add Reset method for ObjectPool.

This commit is contained in:
2023-02-11 23:08:43 +08:00
parent b364005741
commit 9fd685b8b3
7 changed files with 90 additions and 69 deletions

View File

@@ -24,6 +24,7 @@
_objs[_index++] = null;
}
if (obj == null) obj = Construct();
else Reset(obj);
return obj;
}
/// <summary>
@@ -38,5 +39,10 @@
/// </summary>
/// <returns>The new instance.</returns>
protected abstract T Construct();
/// <summary>
/// Resets an object.
/// </summary>
/// <param name="obj">The object.</param>
protected virtual void Reset(T obj) { }
}
}