您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
25 行
693 B
25 行
693 B
using System.Collections.Generic;
|
|
|
|
namespace UnityEngine.Graphing
|
|
{
|
|
public static class DictionaryPool<TKey, TValue>
|
|
{
|
|
// Object pool to avoid allocations.
|
|
static readonly ObjectPool<Dictionary<TKey, TValue>> k_Pool = new ObjectPool<Dictionary<TKey, TValue>>(null, l => l.Clear());
|
|
|
|
public static Dictionary<TKey, TValue> Get()
|
|
{
|
|
return k_Pool.Get();
|
|
}
|
|
|
|
public static PooledObject<Dictionary<TKey, TValue>> GetDisposable()
|
|
{
|
|
return k_Pool.GetDisposable();
|
|
}
|
|
|
|
public static void Release(Dictionary<TKey, TValue> toRelease)
|
|
{
|
|
k_Pool.Release(toRelease);
|
|
}
|
|
}
|
|
}
|