mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Add RentedSeStringBuilder
Co-authored-by: Soreepeong <3614868+Soreepeong@users.noreply.github.com>
This commit is contained in:
parent
4ac4505d72
commit
9852feaf08
1 changed files with 19 additions and 0 deletions
19
Dalamud/Utility/RentedSeStringBuilder.cs
Normal file
19
Dalamud/Utility/RentedSeStringBuilder.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Lumina.Text;
|
||||||
|
|
||||||
|
namespace Dalamud.Utility;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a temporarily rented <see cref="SeStringBuilder"/> from a shared pool.
|
||||||
|
/// </summary>
|
||||||
|
public readonly struct RentedSeStringBuilder() : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the rented <see cref="SeStringBuilder"/> value from the shared pool.
|
||||||
|
/// </summary>
|
||||||
|
public SeStringBuilder Builder { get; } = SeStringBuilder.SharedPool.Get();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the rented <see cref="SeStringBuilder"/> to the shared pool.
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose() => SeStringBuilder.SharedPool.Return(this.Builder);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue