Monday, October 19, 2009

Using Enum in C#


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        public enum BillType { OPD, IPD, STORE }
        static void Main(string[] args)
        {
            generateInvloce(BillType.IPD);
        }
        public static bool generateInvloce(BillType billType)
        {
            switch (billType)
            {
                case BillType.IPD:
                    Console.WriteLine((int)BillType.IPD);
                    break;
                case BillType.OPD:
                    Console.WriteLine(BillType.OPD.ToString());
                    break;
                case BillType.STORE:
                    Console.WriteLine(BillType.STORE.ToString());
                    break;
                default:
                    break;
            }
            Console.ReadKey();
            return true;
        }
    }
}

1 comment:

  1. Good post, it clears my understandings

    ReplyDelete

Followers

Search This Blog