# IronRuby .Net 4 CTP and dynamic

**URL:** <https://www.ruby-forum.com/t/ironruby-net-4-ctp-and-dynamic/178932>\
**Category:** IronRuby\
**Created:** [November 13, 2009, 6:41pm UTC](https://www.ruby-forum.com/t/ironruby-net-4-ctp-and-dynamic/178932 "2009-11-13T18:41:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Brown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9a140/32.png) [@Patrick\_Brown](https://www.ruby-forum.com/u/Patrick_Brown)\
**Post date:** [November 13, 2009, 6:41pm UTC](https://www.ruby-forum.com/t/ironruby-net-4-ctp-and-dynamic/178932/1 "2009-11-13T18:41:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Patrick\_Brown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9a140/32.png) [@Patrick\_Brown](https://www.ruby-forum.com/u/Patrick_Brown)\
**Post date:** [March 3, 2010, 8:07pm UTC](https://www.ruby-forum.com/t/ironruby-net-4-ctp-and-dynamic/178932/2 "2010-03-03T20:07:27Z")

</div>

Patrick,  
Tomas made a fix for dynamic, and it is now included in the latest  
source  
from git:  
[http://github.com/ironruby/ironruby](http://github.com/ironruby/ironruby)

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

Best Regards,  
Kevin R.
