How it works
prices is the array. total is the sum. They are different names because they mean different things. Writing var total a second time in this block is an error. Keep the collection and the number you computed from it apart.
A working example
var prices = new[] { 1m, 2m };
var total = prices.Sum();
Console.WriteLine(total);Expected output
3
Try this
Keep the collection and the total apart.
Keep the collection and the total apart.