tags:

views:

171

answers:

1

In C# 4, when deriving from DynamicObject and overridding TryInvokeMember, how can one determine whether any parameters supplied at the call site have been passed with out or ref semantics? I can see some private fields in the supplied binder that contain this information (namely the Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder.ArgumentInfo property) but it appears to be inaccessible. I assume this information must be available somewhere otherwise it would limit one's knowledge of supplied input pretty severely.

+2  A: 

I talked to the DLR team about that. Unfortunately, the answer is no, this information is not available for DynamicObject.

The reason is that ref/out parameters are very C# specific. And dynamic objects can be shared between many languages and not all langauges have these notations. DynamicObject is "call-by-value", so your objects can be consumed by different APIs.

Alexandra Rusina
Thanks for the help. I did suspect that it wasn't going to be possible.
Fake Jim