VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-program-to-print-hello-world-without-using-writeline/

⇱ C# Program to Print Hello World Without Using WriteLine - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# Program to Print Hello World Without Using WriteLine

Last Updated : 23 Jul, 2025

Hello World program is the most basic program of any programming language. It prints "Hello world" on the screen. In this article, we will display "Hello World" without using WriteLine Method. So to do this task we use the following methods:

  • Console.OpenStandardOutput(): This method is used to acquire the standard output stream.
  • Console.ReadKey(): This method is used to get the next character pressed by the user and this press key will be displayed in the console window.
  • BeginWrite(): This method is used to begin an asynchronous write operation.
  • AsyncWaitHandle.WaitOne(): This method is used to wait for an asynchronous operation to complete.

For writing Hello World we are taking each separate character in ASCII format and then we are displaying these characters together. 

StringHelloWorld
ASCII Code721011081081113287111114108100

Approach

1. Inside if condition, Write OpenStandardOutput() to display the Hello World.

2. This method is followed by BeginWrite() method that takes integer Bytes.

BeginWrite(new byte[] { 072, 101, 108, 108, 111, 032, 087, 111, 
 114, 108, 100, 0 }, 0, 12, null, null)

3. Finally we are using AsyncWaitHandle.WaitOne() method followed by BeginWrite() method.

BeginWrite(new byte[] { 072, 101, 108, 108, 111, 032, 087, 111, 
 114, 108, 100, 0 }, 0, 12, null, 
 null).AsyncWaitHandle.WaitOne()) 

Example:

Output:

Hello World
Comment
Article Tags:
Article Tags:

Explore