public static double GetAmountValue(PaymentData paymentData, int index) { switch (index) { case 0: return(paymentData.PaymentAmountA); case 1: return(paymentData.PaymentAmountB); case 2: return(paymentData.PaymentAmountC); case 3: return(paymentData.PaymentAmountD); case 4: return(paymentData.PaymentCoins); default: return(0); } }