diff --git a/GBase/DataHandling/Pool/PoolItem.cs b/GBase/DataHandling/Pool/PoolItem.cs index 90fd4e9..1b62010 100644 --- a/GBase/DataHandling/Pool/PoolItem.cs +++ b/GBase/DataHandling/Pool/PoolItem.cs @@ -14,6 +14,14 @@ namespace GBase.DataHandling.Pool } public T Item { get; } - public bool InUse { get; set; } + public bool InUse { get; private set; } + + public T Use() + { + InUse = true; + return Item; + } + + public void Dispose() => InUse = false; } } \ No newline at end of file diff --git a/GBase/Interfaces/DataHandling/Pool/IPoolItem.cs b/GBase/Interfaces/DataHandling/Pool/IPoolItem.cs index 8cdb3d9..6833696 100644 --- a/GBase/Interfaces/DataHandling/Pool/IPoolItem.cs +++ b/GBase/Interfaces/DataHandling/Pool/IPoolItem.cs @@ -2,11 +2,15 @@ // Created: 2020-09-19 // Copyright(c) 2020 SimonG. All Rights Reserved. +using System; + namespace GBase.Interfaces.DataHandling.Pool { - public interface IPoolItem + public interface IPoolItem : IDisposable { T Item { get; } - bool InUse { get; set; } + bool InUse { get; } + + T Use(); } } \ No newline at end of file