Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-83.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e0c758fb78bb2caf80731f61ff335ef0b2741d47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// This test probes that we treat events differently than fields
// This used to cause a compiler crash.
//
using System;

delegate void PersonArrivedHandler (object source, PersonArrivedArgs args);

class PersonArrivedArgs /*: EventArgs*/ {
    public string name;
    public PersonArrivedArgs (string name) {
	this.name = name;
    }
}

class Greeter {
    string greeting;

    public Greeter (string greeting) {
	this.greeting = greeting;
    }

    public void HandlePersonArrived (object source, PersonArrivedArgs args) {
	Console.WriteLine(greeting, args.name);
    }
}

class Room {
    public event PersonArrivedHandler PersonArrived;

    public Room () {
	    // Assign a value to it, this also used to crash the compiler.
	    PersonArrived = null;
    }

    public void AddPerson (string name) {
	PersonArrived(this, null); //(this, PersonArrivedArgs(name));
    }
}

class DelegateTest {
    public static int Main () {
	return 0;
    }
}