public enum PaymentType
Now We are going to assigned one of the value to this enum instance and then with the help of HasFlag method we are going to check whether particular value is assigned to enum or not like following.
protected void Page_Load(object sender, EventArgs e)
PaymentType paymentType = PaymentType.CreditCard;
Response.Write("Process Debit Card");
Response.Write("Process Credit Card");
Now Let’s check out in browser as following.
As expected it will print process Credit Card as we have assigned that value to enum. That’s it It’s so simple and cool. Stay tuned for more.. Happy Programming..