CSScriptEvaluatorExtensions.HostApp.UnloadingSamples.LoadMethodRemotely C# (CSharp) Метод

LoadMethodRemotely() публичный Метод

public LoadMethodRemotely ( ) : void
Результат void
            public void LoadMethodRemotely()
            {
                // LoadMethodRemotely is essentially the same as LoadCodeRemotely. It just deals not with the 
                // whole class definition but a single method(s) only. And the rest of the class definition is 
                // added automatically by CS-Script. The auto-generated class declaration also indicates 
                // that the class implements ICalc interface. Meaning that it will trigger compile error
                // if the set of methods in the script code doesn't implement all interface members.
var script = CSScript.Evaluator
                        .LoadMethodRemotely<IFullCalc>(
                                        @"public int Sum(int a, int b)
                                            {
                                                return a+b;
                                            }
                                            public int Sub(int a, int b)
                                            {
                                                return a-b;
                                            }");

Console.WriteLine("{0}: {1}", nameof(LoadMethodRemotely), script.Sum(15, 3));

script.UnloadOwnerDomain();
            }