PoolCore 类
对象池抽象接口,用于创建和管理可重复使用的对象实例。
实现
继承成员
命名空间: Fantasy.Pool
程序集: Fantasy.Net.dll
语法
public abstract class PoolCore : IDisposable
构造函数
| 编辑本文 查看源代码PoolCore(int)
构造函数
声明
protected PoolCore(int maxCapacity)
参数
类型 | 名称 | 描述 |
---|---|---|
int | maxCapacity | 初始的容量 |
属性
| 编辑本文 查看源代码Count
池子里可用的数量
声明
public int Count { get; }
属性值
类型 | 描述 |
---|---|
int |
方法
| 编辑本文 查看源代码Dispose()
销毁方法
声明
public virtual void Dispose()
Rent(Type)
租借
声明
public IPool Rent(Type type)
参数
类型 | 名称 | 描述 |
---|---|---|
Type | type | 租借的类型 |
返回
类型 | 描述 |
---|---|
IPool |
异常
类型 | 条件 |
---|---|
NotSupportedException |
Rent<T>()
租借
声明
public T Rent<T>() where T : IPool, new()
返回
类型 | 描述 |
---|---|
T |
类型参数
名称 | 描述 |
---|---|
T |
Return(Type, IPool)
返还
声明
public void Return(Type type, IPool obj)
参数
类型 | 名称 | 描述 |
---|---|---|
Type | type | |
IPool | obj |