[TypeScript] Dictionary范例

[TypeScript] Dictionary范例

Playground

Samples

class Dictionary {
    [index: string]: string;
}

class Test {

    public run() {
        var parameters = new Dictionary();
        parameters["A"] = "A01";
        parameters["B"] = "B01";
        parameters["C"] = "C01";

        for (var key in parameters) {
            alert(
                "key=" + key + "\n" +
                "value=" + parameters[key] + "\n"
                );
        }
    }
}

var test = new Test();
test.run();
posted @ 2015-07-07 15:47  Clark159  阅读(578)  评论(0编辑  收藏  举报