So, I was wondering if it is acceptable practice or bad practice to use both integer and character types within an Enum type. For example, I am currently working with a payment processing vendor system. They can call our soap request and send ids for payment types anywhere from 1 to 25 and also can send characters such as C,M, and O. I wanted to use an enum for clarity in reading the code, but one problem I am having is that I also wanted to sue a switch for this. Is this a bad practice on handling this, also can I handle this safely in a switch or should I just do a if else, and try parse for handling incorrect casting?
Example of Enum values would be the following:
internal enum PaymentTypeEnum
{
/// <summary>
/// Payment Type Id via Phone from ACI. Note: Int32
/// </summary>
PhonePayment_IVR = '9',
/// <summary>
/// Payment Type Id via electronic from ACI. Note: Int32
/// </summary>
eCollectPayment = '5',
/// <summary>
/// Payment Type Id for CANCEL payment. Note: Char
/// </summary>
CancelPayment = 'C',
}
(PaymentTypeEnum)9instead of(PaymentTypeEnum)'9'. I would prefer defining a lookup method or dictionary that makes thechartype explicit.25?