* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / tests / test-83.cs
1 //
2 // This test probes that we treat events differently than fields
3 // This used to cause a compiler crash.
4 //
5 using System;
6
7 delegate void PersonArrivedHandler (object source, PersonArrivedArgs args);
8
9 class PersonArrivedArgs /*: EventArgs*/ {
10     public string name;
11     public PersonArrivedArgs (string name) {
12         this.name = name;
13     }
14 }
15
16 class Greeter {
17     string greeting;
18
19     public Greeter (string greeting) {
20         this.greeting = greeting;
21     }
22
23     public void HandlePersonArrived (object source, PersonArrivedArgs args) {
24         Console.WriteLine(greeting, args.name);
25     }
26 }
27
28 class Room {
29     public event PersonArrivedHandler PersonArrived;
30
31     public Room () {
32             // Assign a value to it, this also used to crash the compiler.
33             PersonArrived = null;
34     }
35
36     public void AddPerson (string name) {
37         PersonArrived(this, null); //(this, PersonArrivedArgs(name));
38     }
39 }
40
41 class DelegateTest {
42     static int Main () {
43         return 0;
44     }
45 }
46
47