static void Main(string[] args) { Console.WriteLine("Ask the magic 8 Ball"); using (EightBallClient ballClient = new EightBallClient("NetTcpBinding_IEightBall")) { Console.WriteLine("Your question"); string question = Console.ReadLine(); string answer = ballClient.ObtainAnswerToQuestion(question); Console.WriteLine("8-ball says: {0}", answer); } Console.ReadLine(); }
static void Main() { Console.WriteLine("***** Ask the Magic 8 Ball (VS) *****"); // using (EightBallClient ball = new EightBallClient()) { using (EightBallClient ball = new EightBallClient("BasicHttpBinding_IEightBall")) { Console.WriteLine("Your question: "); string question = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine($"Question : {question}"); Console.WriteLine($"Answer : {answer}"); } }
static void Main(string[] args) { Console.WriteLine("***** Ask the Magic 8 Ball *****\n"); using (EightBallClient ball = new EightBallClient("BasicHttpBinding_IEightBall")) { Console.Write("Your question: "); string question = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine("8-Ball says: {0}", answer); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("***** Ask the Magic 8 Ball *****\n"); using (EightBallClient ball = new EightBallClient("NetTcpBinding_IEightBall")) //using (EightBallClient ball = new EightBallClient("BasicHttpBinding_IEightBall")) { Console.Write("Your question: "); string question = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine("8-Ball says: {0}", answer); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine(" ****** Ask the question you want ****"); // MagicEightBallService1 ball = new MagicEightBallService1(); //引入类型来操作 using (EightBallClient ball = new EightBallClient())//通过引入服务生成的代码来操作 { while (true) { Console.WriteLine(" Your question"); string question = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine(answer); } } }