repo.or.cz
/
mcs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2009-02-15 Jonathan Chambers <joncham@gmail.com>
[mcs.git]
/
tests
/
test-anon-07.cs
blob
0dcd92fb3bc3b89c2ebc03a696f974e0caa72634
1
//
2
// Tests havign more than one anonymous method that captures the same variable
3
//
4
using
System
;
5
6
delegate void
D
();
7
8
class
X
{
9
static int
Main
()
10
{
11
int
a
=
0
;
12
D d1
=
delegate
{
13
Console
.
WriteLine
(
"First"
);
14
a
=
1
;
15
};
16
17
D d2
=
delegate
{
18
Console
.
WriteLine
(
"Second"
);
19
a
=
2
;
20
};
21
if
(!
t
(
a
,
0
))
22
return
1
;
23
d1
();
24
if
(!
t
(
a
,
1
))
25
return
2
;
26
d2
();
27
if
(!
t
(
a
,
2
))
28
return
3
;
29
Console
.
WriteLine
(
"Test passes OK"
);
30
return
0
;
31
}
32
33
static bool
t
(
int
a
,
int
b
)
34
{
35
return
a
==
b
;
36
}
37
}