1) Yes, you can pass parameters via InvokeMember. 2) You can call methods with ByRefs from Ruby. An example could be Dictionary<int, int>.TryGetValue:
>>> dict = System::Collections::Generic::Dictionary[Fixnum, Fixnum].new => System.Collections.Generic.Dictionary`2[System.Int32,System.Int32] >>> dict.add 1,2 => nil >>> dict.try_get_value 1 => [true, 2] The second parameter to TryGetvalue is an <Out> ByRef. You can either omit an argument for such parameter or pass an instance of System.Runtime.CompilerServices.StrongBox<T>. If you omit the argument the result is returned in the return value (as shown above). If you pass an instance of StrongBox the value is updated in situ. Similarly for in-out ByRef parameters. You pass in the input value and either get the output value in the resulting array or the StrongBox value if you use a StrongBox instance. Tomas From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Julian Bishop Sent: Sunday, June 06, 2010 10:33 PM To: ironruby-core@rubyforge.org Subject: [Ironruby-core] VB.Net - Ruby interop Hi, A couple of technical questions regarding how to leverage Ruby from VB.Net and vice versa: 1) Is the ScriptScope the only option for passing object refs into Ruby? I mean can they also be passed as parameters to the Ruby methods called by InvokeMember? 2) Ruby has no need for passing parameters "ByRef" like you can in VB because Ruby's return statement so naturally returns an arbitrary list of objects as an array, and Ruby supports multiple assignment on a single line. But I have legacy VB methods with ByRef parameters that really do change which objects the parameters reference in the caller. I would like to be able to call these VB methods from Ruby code, but since Ruby has no such thing as ByRef, I don't know what kind of behavior I should expect. Can the Ruby variables passed as parameters get reassigned by VB code to point to VB objects without any additional shenanigans? If not, then is there an established workaround for ByRef parameters? Has this odd situation been addressed yet? (I don't want to rewrite/retest legacy code that already works just fine). Thanks, Julian.
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core