protected Dictionary<string , string> xmlList = new Dictionary<string , string>();
protected System.Collections.ArrayList list = new System.Collections.ArrayList();
我已将字典存储在这样的数组列表中..
xmlList.Add( "image" , "images/piece1.png" );
xmlList.Add( "description" , " Experience why entertainment is more amazing with Xbox." );
xmlList.Add( "title" , "Downloads" );
list.Add( xmlList );
xmlList.Clear();
xmlList.Add( "image" , "images/piece2.png" );
xmlList.Add( "description" , "Limited-time offer: Buy Office now, get the next version free.*" );
xmlList.Add( "title" , "Security & Updates" );
list.Add( xmlList );
如何从 arraylist 访问字典的每个元素?
<% for (int i = 0; i < list.Count; i++)
{
foreach(Dictionary<string , string> itemList in list)
{
Response.Write( itemList["image"] );
}
}
%>
这给了我两次相同的结果'images/piece2.png'..
我做不到
foreach(Dictionary<string , string> itemList in list[i])
{
Response.Write( itemList["image"] );
}