perf!: events refactored throughout all the project to use Event<> class
All delegate events are refactored to use the Event<TSender> and Event<TSender, TArgument> for performance issues regarding delegate events creating garbage, also this gives us better control on event invocation since C# Delegates did also create unnecessary garbage during Delegate.DynamicInvoke
This commit is contained in:
@@ -9,12 +9,12 @@ public interface IEntity : IInitializable, IHasStateEnable
|
||||
/// Event triggered when the <see cref="Id"/> of the <see cref="IEntity"/> changes.
|
||||
/// The string action parameter is the previous <see cref="Id"/> of the <see cref="IEntity"/>.
|
||||
/// </summary>
|
||||
event IdChangedEventHandler? OnIdChanged;
|
||||
Event<IEntity, IdChangedArguments> OnIdChanged { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the <see cref="IEntity"/>.
|
||||
/// </summary>
|
||||
string Id { get; set; }
|
||||
|
||||
delegate void IdChangedEventHandler(IEntity sender, string previousId);
|
||||
readonly record struct IdChangedArguments(string PreviousId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user