.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

Enum switch case

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

C# enum concept. in .NET Framework. Sample code example in c#
 

Employee detail for job
using System;

enum Emp : byte 
{
  Manager = 10,
  Programmer = 1,
  Developer = 9
}

class charles
{
  public static void Func(Emp e)
  {
    switch(e)
    {
      case EmployeeType.Programmer:
        Console.WriteLine("Emp.Programmer");
        break;
      case EmployeeType.Manager:
        Console.WriteLine("Emp.Manager");
        break;
      case EmployeeType.Developer:
        Console.WriteLine("Emp.Developer");
        break;
      default: break;
    }
  }
  public static void Main(string[] args)
  {
    
    Emp e;
    e = Emp.Developer;
    Func(e);

  }
}

     

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