How to read value from the user in c#
Here we are using place holder syntax for the printing name in the console applicaion
It is an array form,we can use many or several entry print at a single time.
Console.ReadLine : Read string from console
Reads the next line of characters from the standard input stream.
Exception:
System.IOException
System.OutOfMemoryException
System .ArgumentOutOfRangeException
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter your first name");
string FirstName = Console.ReadLine();//It return type is string
Console.WriteLine("Please enter your first name");
string Surname = Console.ReadLine();//It return type is string
Console.WriteLine("Hello" + FirstName); //"Hello" =static,FirstName=Dynamic
Console.WriteLine(Surname);
Console.WriteLine("Hello {0},{1}",FirstName,Surname); //Array form
}
}
o/p
It is depends upon the user :)
It is an array form,we can use many or several entry print at a single time.
Console.ReadLine : Read string from console
Reads the next line of characters from the standard input stream.
Exception:
System.IOException
System.OutOfMemoryException
System .ArgumentOutOfRangeException
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter your first name");
string FirstName = Console.ReadLine();//It return type is string
Console.WriteLine("Please enter your first name");
string Surname = Console.ReadLine();//It return type is string
Console.WriteLine("Hello" + FirstName); //"Hello" =static,FirstName=Dynamic
Console.WriteLine(Surname);
Console.WriteLine("Hello {0},{1}",FirstName,Surname); //Array form
}
}
o/p
It is depends upon the user :)
Comments