Home
Manage Your Code
Snippet: Events and Delegates (C#)
Title: Events and Delegates Language: C#
Description: Code sample Views: 652
Author: Ramachandran Melarcode Date Added: 6/27/2008
Copy Code  
1using System;
2
3using System.Collections.Generic;
4
5using System.Text;
6
7namespace testclass
8
9{
10
11public class Ram_Class
12
13{
14
15private int XX =20;
16
17private int YY = 10;
18
19public delegate int mycal(int zz, int qq);
20
21public event mycal myevent;
22
23static void Main(string[] args)
24
25{
26
27testclass.Ram_Class obj = new testclass.Ram_Class();
28
29obj.Sum(2, 2);
30
31}
32
33
34public int sum
35
36{
37
38get
39
40{
41
42throw new System.NotImplementedException();
43
44}
45
46set
47
48{
49
50}
51
52}
53
54public int Sum(int xx, int yy)
55
56{
57
58myevent += new mycal(add);
59
60myevent(2, 3);
61
62return (this.XX + this.YY);
63
64}
65
66public int add(int zz, int qq)
67
68{
69
70//zz = this.XX;

71
72//qq = this.YY;

73
74return (zz-qq);
75
76}
77
78public int multiplication(int aa, int bb)
79
80{
81
82aa = this.XX;
83
84bb = this.YY;
85
86return (aa * bb); 
87
88
89}
90
91}
92
93}
94