Last Updated: February 25, 2016
·
728
· badawe

Delegate Example

A simple way of delegate utilization on C# / Unity

//C# Delegate:
 public delegate [return] DelegateName([type parameter]...);

//Sample:
public delegate void CalbackHandler(int pIndex);

//So you can use it as a parameter to other method:
public void PassDelegateByParameter( CallbackHandler pHandler )
{
        pHandler( 1 ); // it will invoke pHandler delegate.
}