当前位置: 首页>>代码示例>>C#>>正文


C# CalculatorClient.Add方法代码示例

本文整理汇总了C#中CalculatorClient.Add方法的典型用法代码示例。如果您正苦于以下问题:C# CalculatorClient.Add方法的具体用法?C# CalculatorClient.Add怎么用?C# CalculatorClient.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CalculatorClient的用法示例。


在下文中一共展示了CalculatorClient.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: button1_Click

		private void button1_Click(object sender, RoutedEventArgs e)
		{
			using (var proxy = new CalculatorClient())
			{
				int result1 = proxy.Add(1, 2);
				double result2 = proxy.Add(1.0, 2.0);
				labelUsualResult.Content = string.Format("int: {0}, double: {1}", result1, result2);
			}
		}
开发者ID:Helen1987,项目名称:edu,代码行数:9,代码来源:MainWindow.xaml.cs

示例2: Main

        static void Main(string[] args)
        {
            //create an instance of wcf proxy
            CalculatorClient client = new CalculatorClient();
            //call the service operations
            double value1 = 100.00d;
            double value2 = 15.99d;
            double result= client.Add(value1,value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);
            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            //Step 3: Closing the client gracefully closes the connection and cleans up resources.
            client.Close();
        }
开发者ID:Edward-Zhou,项目名称:GettingStartedWCF,代码行数:30,代码来源:Program.cs

示例3: Main

        static void Main()
        {
            // Create a proxy with given client endpoint configuration
            CalculatorClient client = new CalculatorClient();

            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:35,代码来源:client.cs

示例4: Main

        static void Main()
        {
            // Create a client
            CalculatorClient client = new CalculatorClient("NetTcpBinding_ICalculator");

            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

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

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
开发者ID:ssickles,项目名称:archive,代码行数:30,代码来源:Client.cs

示例5: Main

        static void Main(string[] args)
        {
            var client = new CalculatorClient();
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
开发者ID:trasa,项目名称:Wotan,代码行数:32,代码来源:Program.cs

示例6: Main

 static void Main(string[] args)
 {
     CalculatorClient proxy = new CalculatorClient();
     Console.WriteLine("Client is running at " + DateTime.Now.ToString());
     Console.WriteLine("Sum of two numbers... 5+5 =" + proxy.Add(5, 5));
     Console.ReadLine();
 }
开发者ID:chungvodim,项目名称:HelloWCF,代码行数:7,代码来源:Program.cs

示例7: DoCalculations

        static void DoCalculations(CalculatorClient client)
        {
            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:26,代码来源:client.cs

示例8: CallService

        public static void CallService(string endpointName)
        {
            CalculatorClient client = new CalculatorClient(endpointName);

            Console.WriteLine("Calling Endpoint: {0}", endpointName);
            // Call the Add service operation.
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
            Console.WriteLine();

            client.Close();

        }
开发者ID:ssickles,项目名称:archive,代码行数:33,代码来源:client.cs

示例9: Main

        static void Main(string[] args)
        {
            // Create a proxy with default client endpoint configuration.
            CalculatorClient client = new CalculatorClient();
            // Add
            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Subtract
            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Multiply
            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Divide
            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

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

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
开发者ID:buihoangthien,项目名称:Nhom6-ThoiKhoaBieuGiangVien,代码行数:35,代码来源:Program.cs

示例10: Main

        static void Main(string[] args)
        {
            ServiceReference1.CalculatorClient client = new CalculatorClient();

            double value1 = 100.00D;
            double value2 = 15.99D;
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1,value2, result);

            value1 = 145.00D;
            value2 = 76.54D;
            result = client.Substract(value1, value2);
            Console.WriteLine("Substract({0},{1}) = {2}",value1,value2,result);

            value1 = 9.00D;
            value2 = 81.25D;
            result = client.Multiply(value1, value2);
            Console.WriteLine("Mutiply({0},{1}) = {2}", value1, value2, result);

            value1 = 22.00D;
            value2 = 7.00D;
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);

            client.Close();

            Console.ReadLine();
        }
开发者ID:siatwangmin,项目名称:GettingStarted,代码行数:28,代码来源:Program.cs

示例11: InvokeCalculatorService

        static void InvokeCalculatorService(EndpointAddress endpointAddress)
        {
            //create a client
            CalculatorClient client = new CalculatorClient();
            client.Endpoint.Address = endpointAddress;
            Console.WriteLine("Invoking CalculatorService at {0}", endpointAddress);
            double value1 = 100.00D;
            double value2 = 15.99D;

            // Call the Add service operation.
            double result = client.Add(value1, value2);
            Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);

            // Call the Subtract service operation.
            result = client.Subtract(value1, value2);
            Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);

            // Call the Multiply service operation.
            result = client.Multiply(value1, value2);
            Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);

            // Call the Divide service operation.
            result = client.Divide(value1, value2);
            Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
            Console.WriteLine();

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();
        }
开发者ID:Edward-Zhou,项目名称:GettingStartedWCF,代码行数:29,代码来源:Program.cs

示例12: Main

        static void Main(string[] args)
        {
            CalculatorClient svc = new CalculatorClient();

            Console.WriteLine(svc.Add(99.3, 29.8));

            svc.Close();
        }
开发者ID:scottyinthematrix,项目名称:WCFPractice,代码行数:8,代码来源:Program.cs

示例13: Add

 public double Add(double n1, double n2)
 {
     CalculatorClient client = new CalculatorClient();
     client.ClientCredentials.UserName.UserName = ServiceSecurityContext.Current.PrimaryIdentity.Name;
     double result = client.Add(n1, n2);
     client.Close();
     return result;
 }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:8,代码来源:FacadeService.cs

示例14: Main

        static void Main(string[] args)
        {
            CalculatorClient client = new CalculatorClient();

            // 使用 "client" 变量在服务上调用操作。
            var result = client.Add(1, 2);
            // 始终关闭客户端。
            client.Close();
        }
开发者ID:ZGHhaswell,项目名称:WcfAuthor,代码行数:9,代码来源:Program.cs

示例15: Main

        static void Main(string[] args)
        {
            CalculatorClient client = new CalculatorClient();

            Console.WriteLine(client.Add(10, 20));
            Console.ReadKey();

            client.Close();
        }
开发者ID:JenekX,项目名称:Service,代码行数:9,代码来源:Program.cs


注:本文中的CalculatorClient.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。