for (var k in dictionary)
{
var key:KeyType = KeyType(k);
var value:ValType = ValType(dictionary[k]); // <-- lookup
// do stuff
}
这是我在一本字典通过条目中使用循环。正如你可以在每次迭代看我演出在字典中查找。有迭代词典(同时保持访问密钥)?
This is what I use to loop through the entries in a dictionary. As you can see in every iteration I perform a lookup in the dictionary. Is there a more efficient way of iterating the dictionary (while keeping access to the key)?
遍历键&放大器; 值
for (var k:Object in dictionary) {
var value:ValType = dictionary[k];
var key:KeyType = k;
}
遍历值更简洁:
for each (var value:ValType in dictionary) {
}