[Ironruby-core] Calling a C# method with a byref parameter

Michael Erasmus michaelerasmus at gmail.com
Thu Feb 11 08:44:46 EST 2010


Hi Everyone,

I'm trying to write a IronRuby script that interops with a a .NET assembly
written in C#.

It has a class that derives from a base class in the .NET assembly. One of
the base class protected methods looks like this:

protected void OnNotifyPropertyChanged<T>(string name, ref T localmember, T
value)
 {
         ......
 }

I can't for the life of me figure out how to call this method from IR in my
derived class.
The documentation mentions that you can call *out *parameters without using
them as arguments, but I can't seem to find anything about *ref *params.

If I just try calling the method like this:

OnNotifyPropertyChanged(property_name, value, value)

I get this error:

*Microsoft.Scripting.Core:0:in `Bind': Expression of type
'IronRuby.Builtins.Muta*
*bleString&' cannot be used for parameter of type
'IronRuby.Builtins.MutableStrin*
*g' of method 'Void
#base#OnNotifyPropertyChanged[MutableString](System.String, I*
*ronRuby.Builtins.MutableString ByRef, IronRuby.Builtins.MutableString)'
(Argumen*
*tError)*
*        from Microsoft.Scripting.Core:0:in `BindCore'*
*        from ./dynamic_event_item.rb:22:in `method_missing'*
*        from :0*


Am I missing something?

Thanks

Michael Erasmus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100211/37bc6165/attachment.html>


More information about the Ironruby-core mailing list