mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-24 20:12:20 +00:00
17 lines
414 B
C#
17 lines
414 B
C#
using System.Core.Extensions;
|
|
|
|
namespace Daybreak.API.Models;
|
|
|
|
public sealed class CallbackRegistration<T>(Guid uid, T callback, Action onDispose) : IDisposable
|
|
where T : Delegate
|
|
{
|
|
public Guid Uid { get; } = uid;
|
|
public T Callback { get; } = callback.ThrowIfNull();
|
|
private readonly Action onDispose = onDispose.ThrowIfNull();
|
|
|
|
public void Dispose()
|
|
{
|
|
this.onDispose();
|
|
}
|
|
}
|