Possible duplicate:
C # 4.0 Dynamics
I have a function
void Foo(dynamic thingy)
{
int bar = thingy.Id;
}
and i call it that
Foo(new {Id=42, Color="red", size = "XL"});
This works great when Foo and the caller are in the same assembly. But when they are not in the same assembly, Foo crashes at runtime with a RuntimeBinderException, saying
'object' does not contain a definition for 'Id'
pointing to the string thingy.Id. The clock in VS shows that it has the Id property. Any ideas?
EDIT: this will be closed by dup. But I thought I would just record the fact that the internally visible attribute of the assembly worked perfectly - tx manji
pm100 source
share