例子: ArrayList list = new ArrayList();
list = clHotel.List;//clHotel.List是取得的数据
for (int i = 0; i < list.Count; i++)
{
if (((CMHotel)list[i]).Quick_hotel == "Y")
{
((CMHotel)list[i]).Name = ((CMHotel)list[i]).Name + "[Q.C]";
list.Remove(((CMHotel)list[i]));
} }怎么删除不了状态为 ’Y‘ 的数据?
list = clHotel.List;//clHotel.List是取得的数据
for (int i = 0; i < list.Count; i++)
{
if (((CMHotel)list[i]).Quick_hotel == "Y")
{
((CMHotel)list[i]).Name = ((CMHotel)list[i]).Name + "[Q.C]";
list.Remove(((CMHotel)list[i]));
} }怎么删除不了状态为 ’Y‘ 的数据?
list = clHotel.List;//clHotel.List是取得的数据
foreach (CMHotel hotel in list)
{
if (hotel.Quick_hotel == "Y")
{
hotel.Name = hotel.Name + "[Q.C]";//这句有用吗?下面都移除了。。
list.Remove(hotel);
}
}
foreach (CMHotel hotel in clHotel.List)
{
if (hotel.Quick_hotel == "Y")
{
hotel.Name = hotel.Name + "[Q.C]";//这句有用吗?下面都移除了。。
clHotel.List.Remove(hotel);
}
}
ArrayList list = new ArrayList();
ArrayList MoveItemlist = new ArrayList();
list = clHotel.List;//clHotel.List是取得的数据
for (int i = 0; i < list.Count; i++)
{
if (((CMHotel)list[i]).Quick_hotel == "Y")
{
((CMHotel)list[i]).Name = ((CMHotel)list[i]).Name + "[Q.C]";
MoveItemlist.Add((CMHotel)list[i]);
//list.Remove(((CMHotel)list[i]));
} }
list.Remove(MoveItemlist);
代码没试过。
for (int i = list.Count-1; i >=0 ; i--)