C# Getting Started

C# Getting Started

As discussed in Why Learn C#?, C# programming language has built on .NET Framework to build a variety of secure and robust applications such as windows, web or database applications based on our requirements.

Note: To run C# applications, we require to install a .NET Framework component on our machines. In case, if you are using windows operating system, then by default .NET Framework installed on your machine. To know more about .NET Framework versions installed on your machine, check this .NET Framework Versions.

 

Basic Guideline To Run C#
 

Before staring complete C# tutorial, you must know the following guideline. It will help you to write and execute your c# program easily and hassle-free.

We assume you are using Visual Studio:

  • Must check proper opening and closing of curly braces {}.
  • Your program should be properly nested.
  • Press F5 to execute your program.
  • If you get exception, press Ctrl+F5 to stop execution.
  • If you encounter infinite loop press Ctrl+C to break execution.
  • Press F11 continuously to see how your program executes.
  • After completion of each segment, must do exercises at the end of this chapter. It will help you clear your concept and improve your programming skills.


C# programming is very easy to never be bored with this language. After some time, when you will cover basic segment, you will be surely confident in C# programming. Best of luck!

 

Prerequisites for Learning C#

 

To start learning C# as a beginner, you need to have some basic concepts brushed up to learn C# quickly and efficiently. Some of the prerequisites include:

  • Basic computer knowledge such as working with command-line, file systems, and installing applications such as compilers, interpreters, etc.
  • Knowledge of object-oriented programming. C# is an object-oriented programming language, which means that you will need to have a basic understanding of concepts like encapsulation, polymorphism, abstraction, inheritance, interfaces, etc.
  • Basic knowledge of C, C++, or Java just to have a slight understanding of the syntax of C#.

 

Where to write C# code

Before starting your practice it is necessary to know where to write C# code. Luckily, you can write C# program on your notepad as well as Visual Studio. You will learn step by step procedure about how to write, debug and execute C sharp program on your machine.

The easiest way to get started with C#, is to use an IDE (Integrated Development Environment) to edit and compile code.

Applications written in C# use the .NET Framework, so it makes sense to use Visual Studio, as the program, the framework, and the language, are all created by Microsoft.

 

Using Notepad

C# Getting Started

 

Using Visual Studio Code IDE

For this, you will need to download the IDE from its official website. The installation is quite simple and intuitive.

Using Visual Studio Code IDE

 

Using Visual Studio IDE

Microsoft offers three versions of Visual Studio 2022 including community, professional, and enterprise.

For the tutorials on this website, you’ll only need the community edition which is free for students, open-source contributors, and individuals.

01. Download Visual Studio

Before installing Visual Studio 2022, you need to download it to your computer:

  1. First, go to the download Visual Studio Tools page.
  2. Second, click the Free Download button to download Visual Studio 2022.
02. Install Visual Studio

To install Visual Studio, you follow these steps:

  1. First, start the installer.
  2. Second, on the workloads, select the following:
    - .NET desktop development
    - Universal Windows Platform development
  3. Third, click Install and wait for the installer to download the selected components.

It’ll take a while for the installer to complete. And you can launch Visual Studio 2022 when it’s ready.

Download Visual Studio

Also, Visual Studio asks you to select an environment with a color theme. You can select Visual C# and any theme of your choice.