我有兩個數組ARR1和以下類型減去使用LINQ
class Data
{
public int IdProduct;
public double Price;
}
的ARR2,我需要減去ARR2的價格ARR1兩個數組但的項目陣列是不同查詢的結果,所以產品數量arr1不一定與arr2中的產品數量相匹配,並且沒有重複的pr在陣列中生成。
我需要在每個陣列中按乘積做減法乘積,即。
var total =
from a1 in arr1
join a2 in arr2 on a1.IdProducto equals a2.IdProducto
select new
{
Product = a1.IdProduct,
Price = a1.Price - a2.Price
};
什麼豆你到底是什麼意思? (arr2的和) - (arr1的和)? – 2013-04-11 15:16:46