PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/csharp/enum/runme.cs

#
C# | 31 lines | 24 code | 6 blank | 1 comment | 0 complexity | d41e0a348d9c045de8bec2b75d390efb MD5 | raw file
 1using System;
 2
 3public class runme
 4{
 5    static void Main() 
 6    {
 7        // Print out the value of some enums
 8        Console.WriteLine("*** color ***");
 9        Console.WriteLine("    " + color.RED + " = " + (int)color.RED);
10        Console.WriteLine("    " + color.BLUE + " = " + (int)color.BLUE);
11        Console.WriteLine("    " + color.GREEN + " = " + (int)color.GREEN);
12
13        Console.WriteLine("\n*** Foo::speed ***");
14        Console.WriteLine("    Foo::" + Foo.speed.IMPULSE + " = " + (int)Foo.speed.IMPULSE);
15        Console.WriteLine("    Foo::" + Foo.speed.WARP + " = " + (int)Foo.speed.WARP);
16        Console.WriteLine("    Foo::" + Foo.speed.LUDICROUS + " = " + (int)Foo.speed.LUDICROUS);
17
18        Console.WriteLine("\nTesting use of enums with functions\n");
19
20        example.enum_test(color.RED, Foo.speed.IMPULSE);
21        example.enum_test(color.BLUE, Foo.speed.WARP);
22        example.enum_test(color.GREEN, Foo.speed.LUDICROUS);
23
24        Console.WriteLine( "\nTesting use of enum with class method" );
25        Foo f = new Foo();
26
27        f.enum_test(Foo.speed.IMPULSE);
28        f.enum_test(Foo.speed.WARP);
29        f.enum_test(Foo.speed.LUDICROUS);
30    }
31}