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
add comment
[mcs.git]
/
tests
/
gtest-anontype-02.cs
blob
99779fa8cb78a89e4a4d47cdd288bc68ffa5cc55
1
2
// Tests anonymous types initialized with local variables
3
using
System
;
4
using
System
.
Collections
;
5
6
public class
Test
7
{
8
static object
TestA
(
string
s
)
9
{
10
return new
{ s }
;
11
}
12
13
static int
Main
()
14
{
15
string
Foo
=
"Bar"
;
16
int
Baz
=
42
;
17
var
v
=
new
{ Foo, Baz }
;
18
19
if
(
v
.
Foo
!=
"Bar"
)
20
return
1
;
21
if
(
v
.
Baz
!=
42
)
22
return
2
;
23
24
if
(!
TestA
(
"foo"
).
Equals
(
new
{ s = "foo" }
))
25
return
3
;
26
27
Console
.
WriteLine
(
"OK"
);
28
return
0
;
29
}
30
}