[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 + "
" +
"value=" + parameters[key] + "
"
);
}
}
}
var test = new Test();
test.run();