#1 2018-06-25 10:35:02

squirrel
Member
Registered: 2015-08-13
Posts: 155

Execute interface function by name

On server-side, I sometimes need to execute interface functions. I know that, if the function name is known at design-time, I can get an instance of the interface and run it like so:

  Server.Service<ICalculator>.Add(10,20)

Is it possible to run Calculator.Add if the function name is only known at runtime (stored externally as a string)?  I already verify that the interface is registered and that the function exists.

InterfaceFactory.Methods[I].InterfaceDotMethodName

Offline

#2 2018-06-25 14:52:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Execute interface function by name

I does not make much sense, since the name is just a small part of the needed information: you need full explicit parameter list to actually call or fake the method call.

Just add a string parameter to your interface, or use a method-based service.

Offline

Board footer

Powered by FluxBB