Dauris Little
all
  • About
  • Dauris’s Portfolio
  • Blogging Lyf
  • Contact
© 2016 Dauris Little. All rights reserved.
  • Home
  • Blog
  • Programming Languages
  • .NET & .NET Core
  • Discovering C# with Console
November 7, 2025

BLOG & Gossip

Avatar photo
Dauris
Thursday, 30 July 2020 / Published in .NET & .NET Core, C#, Language, Programming Languages

Discovering C# with Console

In this tutorial, we will learn how to write a simple “Hello World!” program in C#. This will get you familiar with the basic syntax and requirements of a C# program.

The “Hello World!” program is often the first program we see when we dive into a new language. It simply prints Hello World! on the output screen

he purpose of this program is to get us familiar with the basic syntax and requirements of a programming language.


“Hello World”

using System;
namespace HelloWorld
{
    class Hello {         
        static void Main(string[] args)
        {
            //Hello comment block 
            Console.WriteLine("Hello World!");
        }
    }
}

Note: This is the default setup when creating a new application within the request solution.

Now you may run the application, press F5  and the output should be: “Hello World!”


Understanding the “Hello World” program and how it works

  • //Hello comment block
    • // – represents the start of a comment section in C#. No worries comment sections/blocks are not executed by the C# compiler. (Consider when reading or using comments for better communicating with developers. To learn more about comments) 
  • namespace HelloWorld {…}
    • is used to define the application namespace. So the example above namespace is called “HelloWorld”
    • the perfect way to see namespace is like a container that will consist of methods, classes, and even other namespaces. (To learn more about namespace)
  • class Hello {…}
    • reflecting on the above example the class is created with the name  – Hello in C#. C# is an object-oriented language and is mandatory for program execution.
  • static void Main(string[], args){…}
    • ‘Main()‘ this a method within the class of “Hello”. During the execution of a C# application, it will start with the ‘Main()‘
  • Console.WriteLine(“Hello World”);
    • to keep it short just remember in console application this will print the text to the user screen.

Tackling Hello World differently

// Hello World! program
namespace HelloWorld
{
    class Hello {         
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello World!");
        }
    }
}

The above code is another way to execute the ‘Hello World’ program. Please take note with the two codes, the orignal code we began with and the code from above, the first difference is the missing “using System;”. Second difference to notice is the adding of the “System” before Console.WriteLine

Don’t worry more on this is another post. 


Take away

  • ‘Main()’ method must be inside the class definition
  • Every C# program has to have a class definition
  • Most importantly the execution begins within the ‘Main()’ method 

So let’s keep it simple as a newbie this is an excellent introduction to C#. If anything within this post is hard to comprehend, don’t worry in the beginning I was the same way as well. As you progress with your read and research everything will begin to fall in place. 

  • Tweet

What you can read next

Using let or var within Swift
Android, SQLite & Kotlin
When over Switch in Kotlin

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

Recent Posts

  • Gesture Controls for Android w/Kotlin

    Incorporating Gesture controls in your android ...
  • Android Rating: In-App Review API

    An app rating and reviews are crucial if you wa...
  • QR Reader in Android w/ Kotlin

    Turn your phone's camera into a QR scanner...
  • Creating Advance Custom Snackbar w/ Kotlin

    Ask 100 different developers about what they fi...
  • Swift Has Tuple

    Swift provides us with a type called Tuple whic...

Recent Comments

  • Homepage on Integrating Google’s reCAPTCHA w/Android
  • Cleora Weideman on Integrating Google’s reCAPTCHA w/Android
  • alpha femme keto Reviews on Integrating Google’s reCAPTCHA w/Android
  • best skin care products reviews on Integrating Google’s reCAPTCHA w/Android
  • Robyn on Integrating Google’s reCAPTCHA w/Android

Archives

  • January 2022
  • December 2021
  • September 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • October 2020
  • August 2020
  • July 2020
  • May 2020
  • March 2020
  • February 2020
  • December 2019
  • October 2019
  • September 2019
  • May 2019
  • March 2019
  • February 2019
  • January 2019
  • August 2018
  • April 2018
  • August 2017
  • November 2016
  • August 2016

Categories

  • .NET & .NET Core
  • Active Directory
  • Android
  • API
  • bitcoin
  • blog
  • C#
  • Development
  • E-Commerce
  • HTML5
  • iOS
  • Java
  • Javascript
  • Kotlin
  • Language
  • Like I Am Five
  • Mobile Development
  • New Web Site
  • Programming Languages
  • Swift
  • Tutorial
  • Uncategorized
  • Web Application Development
  • Windows AD

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

© 2015. All rights reserved. Buy Kallyas Theme.

TOP
This site uses tracking cookies to personalize content and ads. AcceptLearn More