C Method for reading string from console

  • 2021-07-01 08:06:37
  • OfStack

This article illustrates how C # reads strings from the console. Share it for your reference. The specific implementation method is as follows:


using System;
class ReadLine
{
  public static void Main()
  {
  Console.Write("Please enter your favorite animal: ");
  string animal = Console.ReadLine();
  Console.WriteLine("Good choice: " + animal);
  }
}

I hope this article is helpful to everyone's C # programming.


Related articles: