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


C# CalculatorClient.Open方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            CalculatorClient client1 = new CalculatorClient("calculatorservice");
            client1.Open();
            CalculatorClient client2 = new CalculatorClient("calculatorservice");
            client2.Open();

            client1.Close();
            client2.Close();

            Console.WriteLine("ChannelFactory的状态: {0}", client1.ChannelFactory.State);
            Console.WriteLine("ChannelFactory的状态: {0}\n", client2.ChannelFactory.State);

            EndpointAddress address = new EndpointAddress("http://127.0.0.1:3721/calculatorservice");
            Binding binding = new WS2007HttpBinding();

            CalculatorClient client3 = new CalculatorClient(binding, address);
            client3.Open();
            CalculatorClient client4 = new CalculatorClient(binding, address);
            client4.Open();

            client3.Close();
            client4.Close();

            Console.WriteLine("ChannelFactory的状态: {0}", client3.ChannelFactory.State);
            Console.WriteLine("ChannelFactory的状态: {0}", client4.ChannelFactory.State);

            Console.Read();
        }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:29,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Client Connecting...");
            CalculatorClient client = new CalculatorClient();
            client.Open();

            Console.Write("Adding 2 + 2 - Answer: ");
            Console.WriteLine(client.Add(2, 2));

            Console.Write("Subtracting 2 - 2 - Answer: ");
            Console.WriteLine(client.Subtract(2, 2));

            Console.Write("Dividing 2 / 2 - Answer: ");
            Console.WriteLine(client.Divide(2, 2));

            Console.Write("Multiplying 2 * 2 - Answer: ");
            Console.WriteLine(client.Multiply(2, 2));

            client.Close();
            Console.ReadLine();
        }
开发者ID:ageofempierswar,项目名称:WCF-labbar,代码行数:21,代码来源:Program.cs


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