summaryrefslogtreecommitdiff
path: root/Examples/csharp
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2004-05-31 07:13:12 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2004-05-31 07:13:12 +0000
commite18288ecabbc70645ebe74c09c9b5f35d6d221f3 (patch)
tree171ffc13216cef1a58e66ddafd6bafd9d7ca4d9e /Examples/csharp
parent8e3942823f49eb390ceabbaf7ffc271e8919ee2e (diff)
downloadswig-e18288ecabbc70645ebe74c09c9b5f35d6d221f3.tar.gz
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
Diffstat (limited to 'Examples/csharp')
-rw-r--r--Examples/csharp/enum/example.h2
-rw-r--r--Examples/csharp/enum/runme.cs25
2 files changed, 13 insertions, 14 deletions
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);
}
}