mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 18:52:08 +08:00
- 引入 PoolInfo 类来管理对象池的核心数据结构和统计信息 - 添加对象池容量限制功能,超过容量时自动销毁多余对象 - 实现对象池统计功能,跟踪创建、获取、释放、销毁等操作计数 - 新增 GetPoolSize 和 GetActiveCount 方法获取池状态信息 - 添加 SetMaxCapacity 方法设置池的最大容量限制 - 实现 Prewarm 功能用于预创建对象提高性能 - 提供 GetStatistics 方法获取详细的池统计信息 - 添加 IsExternalInit 支持旧版 .NET 框架的 init-only 属性 - 扩展 ArrayPool 添加便捷的扩展方法和自动释放功能 - 新增 StringBuilderPool 提供高性能的字符串构建器复用 - 完善单元测试覆盖新增的所有功能特性
18 lines
553 B
C#
18 lines
553 B
C#
// IsExternalInit.cs
|
|
// This type is required to support init-only setters and record types
|
|
// when targeting netstandard2.0 or older frameworks.
|
|
|
|
#if !NET5_0_OR_GREATER
|
|
using System.ComponentModel;
|
|
|
|
namespace System.Runtime.CompilerServices;
|
|
|
|
/// <summary>
|
|
/// 提供一个占位符类型,用于支持 C# 9.0 的 init 访问器功能。
|
|
/// 该类型在 .NET 5.0 及更高版本中已内置,因此仅在较低版本的 .NET 中定义。
|
|
/// </summary>
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
internal static class IsExternalInit
|
|
{
|
|
}
|
|
#endif |