Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Enumeration Classes - Part 1 (PaymentType Enum - PaymentTypeExtensions)
public static class PaymentTypeExtensions
public static string GetPaymentTypeCode(this PaymentType paymentType)
switch (paymentType)
case PaymentType.CreditCard:
return "CC";
case PaymentType.DebitCard:
return "DC";
throw new ArgumentOutOfRangeException(
nameof(paymentType), paymentType, "Invalid payment type");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.