You can use reflection to find a method. But this will only work if it is a “real” non-dynamic method, which is defined in the usual non-dynamic way, only hidden behind the dynamic keyword.
If, however, the All object is truly dynamic, such as an ExpandoObject or something else derived from System.Dynamic.DynamicObject , the “method” may be something that was associated only with the type at run time, in which case typeof(All).GetMethod will not find anything.
It was Ilya Ivanov, who initially pointed this out in a comment on John Willem's answer . It became apparent that the object is a Microsoft.AspNet.SignalR.Hubs.ClientProxy instance.
Therefore, from the documentation of this type, the solution is:
string methodToCall = XXX; string msg = YYY; ((ClientProxy)(Clients.All)).Invoke(methodToCall, msg);
Jeppe stig nielsen
source share