Write your first Console Application In C# language!

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.

Console Application In C# language

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 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 download page, follow the instructions and download it.

  • Then You have to set 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 environment option and you have to choose path option in system variable window.

  • Paste this in the variable textbox.

 

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 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 for import prebuild .Net modules in our project. Every .net application needs these modules to run properly.

  2. In c# language, every application belongs to the class and Your every code should be written inside of a class also class need the name-space for defining the range of the programme. finally, the name-space is just like a building where various floors available, in other words, it uses for grouping class.

  3. The “Main” function is a specific duty which is automatically called when a console application starts. Here you require to assure to enter the code needed to show the required string in the console application.

  4. Microsoft.net has predefined console keyword which permits to work on console. like that we use “write” keyword for writing any words on the console, in other words, to print on console we use “ConsoleWriteLine” method.

  5. We have to use “ConsoleReadLine” for display output on the console screen. “Read” method will allow to output stay on the console till while we don’t press any key.

  6. Curly braces “{}” is used for defining the scope of every method and class or namespace.

What is visual studio?

Microsoft organization has built this platform for making a dynamic application with the graphical user interface. You can build a web application, mobile application, window app as well as console application as python GUI tool has drag and drop function for the development of graphical user interface application similarly we can use drag and drop function for GUI whether it is window app or web app. as well as you can customize your GUI by your coding knowledge.

Microsoft.Net supports almost 100 of programming languages. Which include  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 programming language then it’s a best and modern programming language. The best part of C# is that it’s support visual studio and along with, you can do your coding on a notepad. However visual studio supports many languages but C# is most popular among them.

Leave a Reply

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

eleven − 4 =