As we know that in C# 6 we can use static classes in using directive. To use static classes in using directive we use the following syntax:
Using static <StaticClassNameWithCompleteNameSpace>;
using System;
using static System.Console;
using static System.Convert;
namespace UsingStaticToPrintDay
{
class Program
{
static void Main(string[] args)
{
try
{
WriteLine("Enter you choice from 1-7 and it will print corresponding day of a week");
int choiceofday = ToInt32(ReadLine());
//Cast int to Enum
string dayOfweek = Enum.GetName(typeof(DayOfWeek), choiceofday);
WriteLine(dayOfweek);
}
catch (Exception ex)
{
WriteLine(ex.Message);
}
}
}
} 549
