Simple action example
Here is a simple example of how use action
//C# Event using Action delegate:
public event Action OnSomeEvent;
public event Action<string> OnSomeEventWithParameters;
// Rising the event, must check if is null:
void SomeMethod()
{
if( OnSomeEvent != null )
OnSomeEvent();
if( OnSomeEventWithParameters != null )
OnSomeEventWithParameters("some parameter");
}
Written by Bruno Mikoski
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Unity
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#