diff options
Diffstat (limited to 'Examples/csharp/callback/runme.cs')
-rw-r--r-- | Examples/csharp/callback/runme.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Examples/csharp/callback/runme.cs b/Examples/csharp/callback/runme.cs new file mode 100644 index 0000000..a104b1a --- /dev/null +++ b/Examples/csharp/callback/runme.cs @@ -0,0 +1,46 @@ +using System; + +public class runme +{ + static void Main() + { + Console.WriteLine("Adding and calling a normal C++ callback"); + Console.WriteLine("----------------------------------------"); + + Caller caller = new Caller(); + using (Callback callback = new Callback()) + { + caller.setCallback(callback); + caller.call(); + caller.resetCallback(); + } + + Console.WriteLine(); + Console.WriteLine("Adding and calling a C# callback"); + Console.WriteLine("------------------------------------"); + + using (Callback callback = new CSharpCallback()) + { + caller.setCallback(callback); + caller.call(); + caller.resetCallback(); + } + + Console.WriteLine(); + Console.WriteLine("C# exit"); + } +} + +public class CSharpCallback : Callback +{ + public CSharpCallback() + : base() + { + } + + public override void run() + { + Console.WriteLine("CSharpCallback.run()"); + } +} + |