A lot of assorted fixes and additions
[mono.git] / mcs / errors / cs0079.cs
1 // cs0079.cs: Events can only appear on the left hand side of += or -=
2 // Line: 19
3  
4 using System;
5
6 class ErrorCS0079 {
7         delegate void Handler ();
8         event Handler privateEvent;
9         public event Handler OnFoo {
10                 add {
11                         privateEvent += value;
12                 }
13                 remove {
14                         privateEvent -= value;
15                 }
16         }
17         void Callback() {
18                 if (privateEvent != null) 
19                         OnFoo();
20         }
21         
22         public static void Main () {
23                 ErrorCS0079 error = new ErrorCS0079 ();
24                 error.OnFoo += new Handler (error.Callback);
25                 error.privateEvent ();
26         }
27 }
28
29