From e18288ecabbc70645ebe74c09c9b5f35d6d221f3 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 31 May 2004 07:13:12 +0000 Subject: Update for new enum wrapping which uses proper C# enums git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5952 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/csharp/enum/example.h | 2 +- Examples/csharp/enum/runme.cs | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'Examples/csharp') diff --git a/Examples/csharp/enum/example.h b/Examples/csharp/enum/example.h index 525d62afc..9119cd9fc 100644 --- a/Examples/csharp/enum/example.h +++ b/Examples/csharp/enum/example.h @@ -5,7 +5,7 @@ enum color { RED, BLUE, GREEN }; class Foo { public: Foo() { } - enum speed { IMPULSE, WARP, LUDICROUS }; + enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 }; void enum_test(speed s); }; diff --git a/Examples/csharp/enum/runme.cs b/Examples/csharp/enum/runme.cs index 3db11b69b..42ba896a2 100644 --- a/Examples/csharp/enum/runme.cs +++ b/Examples/csharp/enum/runme.cs @@ -6,27 +6,26 @@ public class runme { // Print out the value of some enums Console.WriteLine("*** color ***"); - Console.WriteLine(" RED = " + example.RED); - Console.WriteLine(" BLUE = " + example.BLUE); - Console.WriteLine(" GREEN = " + example.GREEN); + Console.WriteLine(" " + color.RED + " = " + (int)color.RED); + Console.WriteLine(" " + color.BLUE + " = " + (int)color.BLUE); + Console.WriteLine(" " + color.GREEN + " = " + (int)color.GREEN); Console.WriteLine("\n*** Foo::speed ***"); - Console.WriteLine(" Foo::IMPULSE = " + Foo.IMPULSE); - Console.WriteLine(" Foo::WARP = " + Foo.WARP); - Console.WriteLine(" Foo::LUDICROUS = " + Foo.LUDICROUS); + Console.WriteLine(" Foo::" + Foo.speed.IMPULSE + " = " + (int)Foo.speed.IMPULSE); + Console.WriteLine(" Foo::" + Foo.speed.WARP + " = " + (int)Foo.speed.WARP); + Console.WriteLine(" Foo::" + Foo.speed.LUDICROUS + " = " + (int)Foo.speed.LUDICROUS); Console.WriteLine("\nTesting use of enums with functions\n"); - example.enum_test(example.RED, Foo.IMPULSE); - example.enum_test(example.BLUE, Foo.WARP); - example.enum_test(example.GREEN, Foo.LUDICROUS); - example.enum_test(1234,5678); + example.enum_test(color.RED, Foo.speed.IMPULSE); + example.enum_test(color.BLUE, Foo.speed.WARP); + example.enum_test(color.GREEN, Foo.speed.LUDICROUS); Console.WriteLine( "\nTesting use of enum with class method" ); Foo f = new Foo(); - f.enum_test(Foo.IMPULSE); - f.enum_test(Foo.WARP); - f.enum_test(Foo.LUDICROUS); + f.enum_test(Foo.speed.IMPULSE); + f.enum_test(Foo.speed.WARP); + f.enum_test(Foo.speed.LUDICROUS); } } -- cgit v1.2.1