Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using revision;
- public class Program
- {
- static void Main(String[] args){
- EventsTest test = new EventsTest();
- test.ExpressionCalculated += Test_ExpressionCalculated;
- test.Calculate(5, 10);
- }
- private static void Test_ExpressionCalculated(int x, int y)
- {
- Console.WriteLine("Expression Calculted Successfully!");
- }
- }
- public class EventsTest
- {
- public event CalculateEventHandler ExpressionCalculated;
- public delegate void CalculateEventHandler(int x, int y);
- public int Calculate(int x, int y)
- {
- int result = x + y;
- // trigger - fire - raise.. event
- ExpressionCalculated?.Invoke(x, y);
- Console.WriteLine(result);
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement