blob: f4f2031e09948f92ac16ef58141bf0ab142b9a69 (
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
|
using System;
public class Foo {
public static void Main ()
{
new Foo (new object[] { "foo" });
}
public Foo (object[] array) : this (array, array[0]) {}
public Foo (object[] array, object context)
{
if (array.GetType().IsArray)
Console.WriteLine ("ok! array is correct type");
else
Console.WriteLine ("boo! array is of type {0}", array.GetType ());
if (array[0] == context)
Console.WriteLine ("ok! array[0] == context!");
else
Console.WriteLine ("boo! array[0] != context!");
foreach (char ch in "123") {
DoSomething += delegate (object obj, EventArgs args) {
Console.WriteLine ("{0}:{1}:{2}", ch, array[0], context);
};
}
}
public event EventHandler DoSomething;
}
|