[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();