Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to an Enumeration, Days, is declared in C#
WhatsApp
Rajan Singh
Jun 08
2015
1.4
k
0
0
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.
Up Next
How to an Enumeration, Days, is declared in C#