Make Your First Console Application In C# language!

advantage of c#

C# language is pronounced as C sharp language. It developed for Microsoft visual studio by Microsoft. However, it is a language that works around the object its called object-oriented programming language. In this article, we will see how to make your first console application so that you will come to know the advantage of C# language by practically.

Build your console application

There is a visual studio available for C# programming which makes programming easier and a fast application development platform. But as a beginner, we should write our code in Notepad++ and compile it by (CMD) command prompt window by using the command. So that we could be a good programmer 

let’s see 

  • first of all, we have to install Notepad++, you can download it from google by simply type “Notepad++” on google. it will show you the download page, follow the instructions and download it.
  • Then You have to set the path of your computer compiler, go to my computer and right-click on the computer icon.
  • Choose in option properties and then choose an advanced option.
  • Then select the environment option and you have to choose path option in system variable window.
  • Paste this in the variable textbox.

advantage of c#

Let’s see now how to code in Notepad++.

Make your first console App by Notepad++

Simply, Go to start panel and search notepad++, or press window key with ‘r’ key and type notepad into that. It will appear notepad++ window. we will not be going to bore you by making hello world app we will print something new which you will know after the compilation of our code. Ok, let’s start coding.

Write code which is given below in the image.

Save your notepad code with any name like “welcome.cs”  where “.cs” is an identifier for the c# language file. 

Now you have to compile this code, however, you need to open a command prompt by pressing key “window+r” and type cmd.

After that navigate your file path where you save it,

Now you have to type “csc welcome.cs” and go to “enter” key and press. where the welcome is a project name and CSC is a method to invoke our code in CPU and “.cs” is an identifier for c#.

 

Code explanation

  1. The first line of our code is used to import .Net modules into our project. Every .net application needs these modules to run properly.
  2. In C # language, every application belongs to a class and every code of yours must be written inside a class, the class also needs a namespace to define the class of the program. Finally, the namespace is like a building where different floors are available, in other words, it is used to group.
  3. The “main” function is a specific duty that is called automatically when the console application starts. Here you have to be assured to enter the required code to show the required string in the console application.
  4. Microsoft.net has predefined the console keyword that allows it to work on the console. Just as we use the “right” keyword to write any word to the console, in other words, to print to the console we use the “console console” method.
  5. We have to use the “console console” for display output on the console screen. The “read” method will allow the output to remain on the console until we press any key.
  6. Curly braces “{}” are used to define the scope of every method and class or namespace.

Suggest: You can also read Amazon Lightsail

What is a visual studio?

The Microsoft organization has built this platform to create a dynamic application with a graphical user interface. You can build a web application, mobile application, window app, and console application, as well as a drag and drop function for developing graphical user interface applications in the Python GUI tool. Similarly, we can use the drag and drop function for GUI, whether it is a window app or a web app. Also, you can customize your GUI with your coding knowledge.

Microsoft.Net supports about 100 programming languages. Which includes C ++ – C # – CSS – Dockerfile – Go – HTML – Java – JavaScript – JSON, PHP, PowerShell, Python, SCSS, T-SQL, TypeScript.

Summary

C # coding is very easy if you want to learn a programming language then it is the best and modern programming language. The best part of C # is that it supports Visual Studio and you can do your coding on Notepad as well. Although Visual Studio supports many languages, C # is the most popular of them.