void paymethod(float price, UIPayment payMethod) { //Create a payInfo class PayInfo payInfo = new PayInfo(); //Select the paymethod and call upon the right method in PayInfo.cs switch (payMethod) { case UIPayment.CreditCard: payInfo.payCredit(price, payMethod); break; case UIPayment.DebitCard: payInfo.payDebit(price, payMethod); break; case UIPayment.Cash: payInfo.payCash(price, payMethod); break; } }