What you want to do is called RPC . In other words, you send the name of the function and its parameters to the server, and in return receive the result of the function.
The most convenient RPC mechanism is called SOAP . It is convenient in that the server provides a description of the functions in the form of a WSDL file, on the basis of which the code can be generated in any language. For example, if the server supports, then you can call the function sumOfTwoNumber(5,6) and it will return 11 . In this case, the generated code itself converts the function and parameters into a format that the server understands, sends it to the server, and receives a response from the server.
As far as I remember, in C # you can connect web services (human SOAP name) as simple packages. It must be borne in mind that the data between the client and the server are transmitted in XML format , because of which traffic can be large and slow. And without the Internet, functions will not work at all.