<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<solid android:color="#bbbbbb"/>
<stroke android:width="1dip" android:color="#000000" />
<corners android:radius="5dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>
</item>
<item android:right="10dp">
<bitmap
android:gravity="right"
android:src="@drawable/btn_dropdown_arrow" />
</item>
我已经删除了想要移除的ID,其中usedID与查询中的productID匹配,因此我将所有匹配的int放入列表中IDsToRemove。现在我不知道该怎么做:
var flowers = from f in c.Product
select new
{
f.ProductID,
f.Price,
f.Name,
f.Description
};
List<int> IDsToRemove = new List<int>();
foreach(var newRow in flowers)
{
if (((List<int>)Session["UsedIDs"]).Contains(newRow.ProductID))
{
IDsToRemove.Add(newRow.ProductID);
}
}
答案 0 :(得分:2)
你可以这样做:
var listInSession = (List<int>)Session["UsedIDs"]);
ddlFlowers.DataSource = flowers.Where(f => !listInSession.Contains(f.ProductID)).ToList();