private void button3_Click(object sender, RoutedEventArgs e) { using (var proxy2 = new ScientificCalculatorClient()) { var result2 = proxy2.Add(3, 4); var result3 = proxy2.Multiply(5, 6); labelScientificCalculatorResult.Content = string.Format("adding: {0}, multiplying: {1}", result2, result3); } }
static void Main(string[] args) { int result; SimpleCalculatorClient proxy1 = new SimpleCalculatorClient(); result = proxy1.Add(1, 2); Console.WriteLine("1 + 2 = " + result); proxy1.Close(); ScientificCalculatorClient proxy2 = new ScientificCalculatorClient(); result = proxy2.Add(3, 4); Console.WriteLine("3 + 4 = " + result); result = proxy2.Multiply(5, 6); Console.WriteLine("5 * 6 = " + result); proxy2.Close(); Console.ReadLine(); }