repo.or.cz
/
mono-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
update readme (#21797)
[mono-project.git]
/
mcs
/
tests
/
test-dictinit-01.cs
blob
1944ae8c4a9b6383c44a858458d1dea0ec7625b2
1
using
System
;
2
using
System
.
Collections
.
Generic
;
3
4
class
Program
5
{
6
static int
Main
()
7
{
8
var
c1
=
new
C
{
9
[
"aaa"
] =
12
,
10
};
11
12
if
(
c1
.
Dict
[
"aaa"
] !=
12
)
13
return
1
;
14
15
var
c2
=
new
C
{
16
[
"a1"
] =
5
,
17
[
"a2"
] =
10
,
18
Value
=
20
,
19
};
20
21
if
(
c2
.
Dict
[
"a1"
] !=
5
)
22
return
2
;
23
24
if
(
c2
.
Dict
[
"a2"
] !=
10
)
25
return
3
;
26
27
if
(
c2
.
Value
!=
20
)
28
return
4
;
29
30
return
0
;
31
}
32
}
33
34
35
class
C
36
{
37
public
Dictionary
<
string
,
int
>
Dict
=
new
Dictionary
<
string
,
int
> ();
38
39
public int
Value
;
40
41
public int this
[
string
arg
] {
42
get
{
43
return
Dict
[
arg
];
44
}
45
set
{
46
Dict
[
arg
] =
value
;
47
}
48
}
49
}