blob: 1944ae8c4a9b6383c44a858458d1dea0ec7625b2 (
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
48
49
|
using System;
using System.Collections.Generic;
class Program
{
static int Main ()
{
var c1 = new C {
["aaa"] = 12,
};
if (c1.Dict ["aaa"] != 12)
return 1;
var c2 = new C {
["a1"] = 5,
["a2"] = 10,
Value = 20,
};
if (c2.Dict ["a1"] != 5)
return 2;
if (c2.Dict ["a2"] != 10)
return 3;
if (c2.Value != 20)
return 4;
return 0;
}
}
class C
{
public Dictionary<string, int> Dict = new Dictionary<string, int> ();
public int Value;
public int this [string arg] {
get {
return Dict [arg];
}
set {
Dict [arg] = value;
}
}
}
|