+
Skip to content

Nordeus/NDelegate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NDelegate

NDelegate is more performant replacement for Action. Whenever new delegate is added or removed from an Action field, the delegate list it contains is actually completely recreated since it is immutable. NDelegate thus reduces the garbage created on subscribe/unsubscribe operations by maintaining a single modifiable list of delegates.

Other benefits include:

  • Exception isolation so that Exception in one handler doesn't prevent other handlers from being called.
  • Recursive dispatch detection
  • Multiple action type support on NDelegate<T>
  • Support for auto unsubscribe

It also has NDelegate<T> version which is an equivalent of an Action<T> with a single parameter but also supports subscribing of Action without parameter and also Action<T, T> which is useful for change data events.

NDelegateUnsubscriber.Create(nDelegate, action) returns IDisposable that will unsubscribe the given action from the given nDelegate in its Dispose method.

About

More optimal version of delegates for C# in Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载