[Ironruby-core] IronRuby .Net 4 CTP and dynamic

Patrick Brown patrickcbrown at gmail.com
Fri Nov 13 12:36:40 EST 2009


Hi

   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
}

Thanks,
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091113/8f76a211/attachment.html>


More information about the Ironruby-core mailing list