/*
C# Programming Tips & Techniques
by Charles Wright, Kris Jamsa
Publisher: Osborne/McGraw-Hill (December 28, 2001)
ISBN: 0072193794
*/
//
// Enum.cs - Demonstrates using a public enum in one class from
// another class
//
// Compile this program with the following command line:
// C:>csc enum.cs
//
namespace nsEnum
{
using System;
public class Enum
{
// Define the enum type
public enum Weekdays
{
Sun, Mon, Tues, Wed, Thurs, Fri, Sat, Count
}
static public void Main ()
{
clsSecond second = new clsSecond();
second.ShowEnum ();
}
}
class clsSecond
{
public void ShowEnum()
{
// Use the class name with the enum name
Console.WriteLine ("Tuesday is day {0} in the week",
(int) Enum.Weekdays.Tues);
}
}
}
|