116
1
using System;
2
using System.Linq;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
Console.WriteLine(
9
Enum.GetValues<PaymentMethods>()
10
.Select((e, i) => $"{i + 1}. {e.ToString()}")
11
.Aggregate((x, y) => x + Environment.NewLine + y));
12
13
var key = Console.ReadLine()!;
14
15
var hasPaymentMethod = Enum.TryParse<PaymentMethods>(key, out var paymentMethod);
16
17
if (!hasPaymentMethod) return;
18
19
var cart = new Cart
20
{
21
TotalPrice = 1453M
22
};
23
24
switch (paymentMethod)
Cached Result