C# Console Hello World Application in visual studio

C# Console Hello World Application in visual studio

Today, We want to share with you C# Console Hello World Application in visual studio.In this post we will show you C# console based application
, hear for Building a Hello World application with .NET Core and C# we will give you demo and example for implement.
In this post, we will learn about C# Hello World: First Console Application Program with an example.

What is console application

The console application is an type of application that runs in a console window same as a C++ and C program application.It does not posses any graphical or visual user interface. C# Console ApplicationConsole Applications works on character based interface.

READ :  AngularJS Datetime format filter in controller

Console Application in C#

To read a line of text(input) from the console window that is entered by user, you can use the Console.ReadLine() method.It will read an input data from the console window and return the input string when user presses the Enter Key.

In C# Console Application, two methods are used extensively.

  1.  Console.Write() : This method writes the specified value to the console window screen
  2.  Console.WriteLine() : This method is very similar to above one except it adds a newline character at the end of the output.

Example: c# console application

The below lines of C#.NET code lets the user input a line of text and displays that text

READ :  Angular RESTful API CRUD Application

string _msg = Console.ReadLine();
Console.WriteLine(_msg);

C# Console Application Example

To write C# console program in visual studio,Open Visual Studio->File -> New Project ->Visual C#-> select Console Applications

using System;
namespace ProgramCall
{
    class Program
    {
        static void Main(string[] args)
        {
            int num1, num2, SUM;

            Console.WriteLine("Enter Two Integers"); 

            num1 = int.Parse(Console.ReadLine());

            num2 = int.Parse(Console.ReadLine()); 
            SUM = num1 + num2;
            Console.WriteLine("Sum  Of  {0}  And  {1}  Is  {2}", num1, num2, SUM);
            Console.Read();// To prevent console from disappear
        }
    }
}

C# Program Structure

using System;

namespace HelloWorldApplication {
   class HelloWorld {
      static void Main(string[] args) {
         /* Creating Hello World Program in C# */
         Console.WriteLine("Creating Hello World Program");
         Console.ReadKey();
      }
   }
}

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

READ :  VueJS Make API GET-POST Requests With Vue Resource

I hope you get an idea about C# Hello World: First Console Application Program.I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

https://pakainfo.com/

Add a Comment

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