C# Program to print the name as a string in the output

C# Program to print the name as a string in the output. In this program, we can print the name as a string in the output at C sharp programming language. A C# datatype, such as int or string, is specified by the type property, and variables are identified by the variableName property. Assigning values to a variable is done with the equal sign (=).

using System;

namespace Main
{
class Program
{
static void Main(string[] args)
{
string name = "Welcome to inlarn.com";
Console.WriteLine(name);
}
}
}

Welcome to inlarn.com

What is String in C Sharp programming language

An object of type String, a string is a collection of text. A sequential read-only collection of Char objects is used to store the text internally. An embedded null character (‘0’) can be used in a C# string because there is no terminating null character at the end.

What is Write() in C# Programming Language

There is no new line character provided when using the Write() method. There is a new line character provided by WriteLine() at the end of the string, which sets a new line for the following output.

To print multiple objects on a single line, use the Write method. It inserts a new line character after the output has been printed. WriteLine moves the cursor to the next line while Write method keeps the cursor on the same line.