0

I just started using IronRuby. This is my test class:

class Program
    {
        static void Main(string[] args)
        {
            var path = @"C:\Users\frays\Desktop\test.rb";
            var engine = Ruby.CreateEngine();
            var scope = engine.Runtime.CreateScope();

            scope.SetVariable("sendNext", new Action<string>(SendNext));

            engine.ExecuteFile(path, scope);

            Console.Read();
        }

        private static void SendNext(string text)
        {
            Console.WriteLine(text);
        }
    }

And this is my test script:

sendNext 'heyyy'

However, when trying to run the program it throws an exception saying wrong number of arguments (1 for 0), even though the method definitely takes a string as an argument.

Gilbert Williams
  • 970
  • 2
  • 10
  • 24

1 Answers1

0

This says that it is not possible Calling IronRuby from C# with a delegate but you can just call the invoke method.

sendNext.Invoke( 'heyyy')
Community
  • 1
  • 1
Max
  • 81
  • 1
  • 4