linq
在使用linq的时候,如果使用sum求和,但source数据源为空的时候是使用不了的,可以使用:
total = query.Select(p => p.Price).DefaultIfEmpty(0m).Sum();