Exemple #1
0
        static void Main(string[] args)
        {
            InstanceContext instance = new InstanceContext(new CalculatorCallbackHandler());

            CalculatorClient client = new CalculatorClient(instance);

            Console.WriteLine("Calling AddTo");
            client.AddTo(2);
            Console.WriteLine("Calling SubtractFrom");
            client.SubtractFrom(1);
            Console.WriteLine("Calling MultiplyBy");
            client.MultiplyBy(22);
            Console.WriteLine("Calling DivideBy");
            client.DivideBy(7);
            Console.WriteLine("Calling GetResult");
            client.GetResult();
            Console.ReadLine();

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();
        }