using System;
public enum LineStyle
{
Solid,
Dotted,
DotDash,
}
class MainClass
{
public static void Main()
{
DrawLine(LineStyle.Solid);
DrawLine((LineStyle) 35);
}
public static void DrawLine(LineStyle lineStyle)
{
switch (lineStyle)
{
case LineStyle.Solid:
Console.WriteLine("draw solid");
break;
case LineStyle.Dotted:
Console.WriteLine("draw dotted");
break;
case LineStyle.DotDash:
Console.WriteLine("draw dotdash");
break;
default:
throw(new ArgumentException("Invalid line style"));
}
}
}
|