如何更新ArrayList会话[] [英] how update ArrayList Session[]
本文介绍了如何更新ArrayList会话[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何更新ArrayList Session []
''
对于例如
ArrayList项目=(ArrayList)Session ["mycart"];
CShoppingCartItem item =新的CShoppingCartItem();
填充会话时
////
项数= 1
idbook 61
intproduceid 61
不足1
名称c
///
我要查询更新
解决方案
而不是ArrayList
,我认为更适合使用List< t>这里.将其更改为List< cshoppingcartitem> items = 新< cshoppingcartitem>();
将您的商品添加到该列表中.当您要更新项目时,请遍历列表并找到该项目并进行更新.
foreach (CshoppingCartItem cItem 项目中的对象) { 如果(条件) { item.inquntity = 2 ; } }
hi
please help me
i am how update ArrayList Session[]
''
for exmaple
ArrayList items = (ArrayList)Session["mycart"];
CShoppingCartItem item = new CShoppingCartItem();
when fill session
////
item count=1
idbook 61
intproduceid 61
inquntity 1
name c
///
i am want inquntity update
解决方案
Instead ofArrayList
, I think it is more suitable for you to use a List<t> here. Change it toList<cshoppingcartitem> items = new <cshoppingcartitem>();
add your items to that list. When you want to update an item loop through the list and find the item and update it.
foreach(CShoppingCartItem cItem in items) { if(condition) { item.inquntity = 2; } }
这篇关于如何更新ArrayList会话[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文