 | Create Deligate |
| using System;
| |
| | namespace ETG.Base.Applications.ETigers.Web.ETech.CSharp
| | {
| |
| | public enum Status {High,Medium,Low}
| |
| | /*
| | Now create the delegate. this delegate will have a return void type and take ETGCarEvetArgs as argument.
| | * The delegate does not have to be declared inside a class. All our event handlers will have the same signature as this delegate.
| |
| | But Delegate can be of any type, void/int/string/bool/or any custom type
| | *
| | * Also we can create a generic delegate [shown in third example]
| | */
| |
| |
| | // Delegate 1. custom return type
| | public delegate Status ETGStatusEventhandler(ETGCarEvetArgs args);
| |
| | // Delegate 2. custom return type
| | public delegate void ETGEventhandler(object sender, ETGCarEvetArgs args);
| |
| | // Delegate 3. this is how we use generic to create a delegate
| | public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e);
| |
| |
| |
| |
| |
| | }
| |
|