TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to an Enumeration, Days, is declared in C#
Rajan Singh
Jun 08
2015
Code
1.3
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
enumDaysByName
{
enum
DaysByName
{
Sunday = 1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
}
class
Enum
{
static
void
Main(
string
[] args)
{
DaysByName today = DaysByName.Sunday;
Console.WriteLine(
"Today is : {0}"
, today);
Console.WriteLine(
"5 * 7 = {0}"
, (
int
) DaysByName.Thursday * (
int
) DaysByName.Saturday);
}
}
}
Output:
Today is : Sunday
4 * 6 = 35
An enumeration
Days
is declared. Two enumerators are explicitly converted to integer and assigned to integer variables.