8b9b85e7f5
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
49 lines
589 B
C#
49 lines
589 B
C#
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;
|
|
}
|
|
}
|
|
} |