8b9b85e7f5
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
52 lines
651 B
C#
52 lines
651 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
class Program
|
|
{
|
|
static int Main ()
|
|
{
|
|
var c = new C {
|
|
["l1"] = new C {
|
|
["l2"] = new C () {
|
|
Value = 10
|
|
}
|
|
},
|
|
["l5"] = {
|
|
["51"] = new C () {
|
|
Value = 100
|
|
}
|
|
}
|
|
};
|
|
|
|
if (c ["l1"]["l2"].Value != 10)
|
|
return 1;
|
|
|
|
if (c ["l5"]["51"].Value != 100)
|
|
return 2;
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
class C
|
|
{
|
|
public Dictionary<string, C> Dict = new Dictionary<string, C> ();
|
|
|
|
public int Value;
|
|
|
|
public C this [string arg] {
|
|
get {
|
|
C c;
|
|
if (!Dict.TryGetValue (arg, out c)) {
|
|
c = new C ();
|
|
Dict [arg] = c;
|
|
}
|
|
|
|
return c;
|
|
}
|
|
set {
|
|
Dict [arg] = value;
|
|
}
|
|
}
|
|
} |