PageRenderTime 93ms CodeModel.GetById 27ms RepoModel.GetById 5ms app.codeStats 0ms

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

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