您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
700 B
33 行
700 B
using System;
|
|
|
|
namespace UnityEditor.Graphing
|
|
{
|
|
public class PooledObject<T> : IDisposable where T : new()
|
|
{
|
|
private ObjectPool<T> m_ObjectPool;
|
|
|
|
public T value { get; private set; }
|
|
|
|
internal PooledObject(ObjectPool<T> objectPool, T value)
|
|
{
|
|
m_ObjectPool = objectPool;
|
|
this.value = value;
|
|
}
|
|
|
|
private void ReleaseUnmanagedResources()
|
|
{
|
|
m_ObjectPool.Release(value);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
ReleaseUnmanagedResources();
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
~PooledObject()
|
|
{
|
|
ReleaseUnmanagedResources();
|
|
}
|
|
}
|
|
}
|