print console c# code example

Example 1: how to print in c#

Console.WriteLine("Hello World");

Example 2: c# print to console

Console.WriteLine("This is C#");

Example 3: c# print console

System.Diagnostics.Debug.WriteLine("This is text");

Example 4: print message in console c#

using System;

namespace ReadLine
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter your name: ");

            string name = Console.ReadLine();
            Console.WriteLine("Hello {0}", name);
        }
    }
}

Example 5: print to console c#

Console.WriteLine("Hello, world!"); // Prints: Hello, world!