com.alicizax.unity.ui.exten.../Runtime/RecyclerView/ObjectPool/IObjectPool.cs
2025-03-12 20:59:12 +08:00

24 lines
569 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
public interface IObjectPool : IDisposable
{
/// <summary>
/// 从池子中分配一个可用对象,没有的话就创建一个
/// </summary>
/// <returns></returns>
object Allocate();
/// <summary>
/// 将对象回收到池子中去,如果池中的对象数量已经超过了 maxSize则直接销毁该对象
/// </summary>
/// <param name="obj"></param>
void Free(object obj);
}
public interface IObjectPool<T> : IObjectPool, IDisposable where T : class
{
new T Allocate();
void Free(T obj);
}