static void Main(string[] args) { using (EightBallClient ball = new EightBallClient()) { 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")) { 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()) { Console.WriteLine("Your question:"); string q = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(q); Console.WriteLine($"Eight ball says: {answer}"); Console.ReadLine(); } }
static void Main(string[] args) { Console.WriteLine("*** Ask the Magic 8 Ball ***"); //NetTcpBinding_IEightBall using (var ball = new EightBallClient("BasicHttpBinding_IEightBall")) { Console.Write("Your question: "); string question = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine($"8-Ball says: {answer}"); } Console.ReadLine(); }
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 question = "Will there be another fire?"; string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine("In response to {0} 8-Ball says: {1}", question, answer); Console.ReadLine(); } }
static void Main(string[] args) { Console.WriteLine("******ask the magic 8 ball******\n"); //1 使用http的方式 //using(EightBallClient ball=new EightBallClient("BasicHttpBinding_IEightBall")) //2 使用tcp的方式 using (EightBallClient ball = new EightBallClient("NetTcpBinding_IEightBall")) { Console.WriteLine("输入你的问题"); string question = Console.ReadLine(); string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine("8-Ball says:{0}", answer); } Console.ReadLine(); }
static void Main(string[] args) { EightBallClient client = new EightBallClient(); while (true) { Console.ReadKey(); Console.WriteLine(client.ObtainAnswerToQuestion("hehe")); } //Console.WriteLine("**** Ask the Magic 8 Ball *****\n"); //using (EightBallClient ball = new EightBallClient()) //{ // Console.WriteLine(); //} }
static void Main(string[] args) { Console.WriteLine("*** Ask the Magic 8 Ball ****\n"); using (EightBallClient ball = new EightBallClient("NetTcpBinding_IEightBall")) { bool isExit = false; while (isExit == false) { Console.WriteLine("Your question:"); string question = Console.ReadLine(); if (question == "Exit") { isExit = true; } else { string answer = ball.ObtainAnswerToQuestion(question); Console.WriteLine($"8-Ball says: {answer}"); } } } Console.ReadLine(); }