Exemple #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            ICalc2 calc2 = client.serviceClientHandler.GetServiceProxy <ICalc2>("calc2", "0");

            calc2.Added += Calc2_Added;

            var result = calc2.Add(100, 200);

            Console.WriteLine(result);

            calc2.Added -= Calc2_Added;
        }
Exemple #2
0
 public static void LoadMethodWithInterface()
 {
     ICalc2 script = CSScript.RoslynEvaluator
                     .LoadMethod <ICalc2>(
         @"public int Sum(int a, int b)
                                   {
                                       return a + b;
                                   }
                                   public int Div(int a, int b)
                                   {
                                       return a/b;
                                   }");
     int result = script.Sum(15, 3);
 }
Exemple #3
0
    void LoadMethod_With_InterfaceAlignment()
    {
        //Note: Method definition code must have at least all interface methods implemented

        ICalc2 script = CSScript.Evaluator.LoadMethod <ICalc2>(
            @"public int Sum(int a, int b)
                                                         {
                                                             return a + b;
                                                         }
                                                         public int Div(int a, int b)
                                                         {
                                                             return a/b;
                                                         }");
        int result = script.Div(15, 3);
    }