.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Select the week from enum

Posted By:laptop charles       Posted Date: August 31, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

selected week will display.
 

C#.net enum concept selected week will be displayed.
using System;
using System.Collections.Generic;
using System.Text;

namespace Enum1
{
    class Program
    {
       
             public enum Week
        {
            Sunday , Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
        }

        static void Main(string[] args)
        {
            Week w=Week.Tuesday;

            switch (w)
                  {
                case Week.Sunday:
                    Console.WriteLine("Selected week is Sunday");
                 break;
                case Week.Monday:
                    Console.WriteLine("Selected week is Monday");
                 break;
                    case Week.Tuesday:
                    Console.WriteLine("Selected week is Tuesday");
                 break;
                case Week.Wednesday:
                    Console.WriteLine("Selected week is Wednesday");
                 break;
                    case Week.Thursday:
                    Console.WriteLine("Selected week is Thursday");
                 break;
                    case Week.Friday:
                    Console.WriteLine("Selected week is Friday");
                 break;
                case Week.Saturday:
                    Console.WriteLine("Selected week is Saturday");
                 break;
           
        }
        Console.ReadLine();
        }
    }
}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend