IronRuby .Net 4 CTP and dynamic


Should I be able to call out to a C# method with this release that
returns a dynamic and access it’s return value?

public class Modifier
public dynamic Modify(IPropertyPolicyInfo info)
dynamic obj = new ExpandoObject();
obj.Name = info.AccountShortName;
obj.Address = new ExpandoObject();
obj.Address.LineOne = info.PolicyHQAddressLine1;
obj.Address.City = info.PolicyHQCityName;
return obj;

I get an exception saying “Unbound variable:value” when puts attempts to
access t.Name. I watch it in the debugger and can see that the dynamic
object is fully populated prior to sending back to the script.

policies.each { |info|
t = modifier.Modify(info)
puts t.Name


Tomas made a fix for dynamic, and it is now included in the latest
from git:

If you build the latest from source (make sure you build the “V4
(or V4 Debug) from ruby4.sln),
your code (which deals with the ExpandoObject) should work as you

Best Regards,
Kevin R.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs