Key Concepts

Review core concepts you need to learn to master this subject

Type safe programming

C# is a general-purpose programming language and can be used to build a variety of things. It’s also a type safe language, meaning that an operation can only be performed on an object only if valid for that type of object. In C#, you define the type of each data in the program. Like Java, C# is an object oriented language. You define objects that interact with each other, making code reusable.

Print Text to Console in C#

In C#, Console.WriteLine() is used to print text to the console. It can also be used to print other data types and values stored in variables.

Getting User Input in C#

In C#, the Console.ReadLine() method is used to get user input. The user input can be stored in a variable for later use. Console.ReadLine() can also be used to prompt the user to press enter on the keyboard.

C# Comments

In C# you can comment out lines of code so that they are not executed. These lines can be used to leave notes and increase the readability of the program. There are two types of comments you can make use of:

Single Line Comment: A single line comment is created with double slash //. Any text or code following the double slash on the same line is ignored during compilation.

Multi-Line Comment: A multi-line comment starts with symbol /* and with end symbol */. Any information between the two symbols is treated as a comment. It is useful for commenting out large blocks of code.

The .Net Platform

.NET is a free, cross-platform, open source developer platform for building many different types of applications.

With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, gaming, and IoT.

You can write .NET apps in C#, F#, or Visual Basic.

Whether you’re working in C#, F#, or Visual Basic, your code will run natively on any compatible OS. Different .NET implementations handle the heavy lifting for you:

Hello World
Lesson 1 of 1
  1. 1
    What would you like to build? If you can name it, you can probably build it with C#. This programming language can be used to make interactive websites, mobile apps, video games, augmented reality…
  2. 2
    Time to run some C# yourself!
 There are two panels here: a text editor containing some C# code and a console, or terminal, that shows output. When you run the code, you’ll see some text printed t…
  3. 3
    We can also read input from a user. The command Console.ReadLine() captures text that a user types into the console.
 In this example, the program writes a question to the console and waits …
  4. 4
    Ironically, an essential tool in programming is the ability to tell a computer to ignore a part of a program. Text written in a program but not run by the computer is called a comment. In C#, a…
  5. 5
    You’ve seen some examples of C# code in action, but learning a programming language is more than just memorizing commands: it’s understanding how it differs from other technologies, joining its com…
  6. 6
    Congrats! You finished your first lesson in C#. In this lesson you learned: * C# is used to make interactive websites, mobile apps, video games, augmented and virtual reality (AR and VR), back-end …

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo