아무도 다음 코드를 설명 할 수 있습니까 return total ?? decimal.Zero
?C#이 줄은 무엇을 의미합니까?
public decimal GetTotal()
{
// Part Price * Count of parts sum all totals to get basket total
decimal? total = (from basketItems in db.Baskets
where basketItems.BasketId == ShoppingBasketId
select (int?)basketItems.Qty * basketItems.Part.Price).Sum();
return total ?? decimal.Zero;
}
다음과 같은 의미입니까?
if (total !=null) return total;
else return 0;
따라서 약 10 개의 응답을 기반으로 "null-coalescing operator"라고 불립니다. : p – Gravy