Nothing Special   »   [go: up one dir, main page]

Codecademy C# Cheatsheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Firefox about:srcdoc

Cheatsheets / Learn C#

Learn C#: Hello World

Console.ReadLine()

The Console.ReadLine() method is used to get Console.WriteLine("Enter your name: ");


user input. The user input can be stored in a variable.
This method can also be used to prompt the user to
name = Console.ReadLine();
press enter on the keyboard.

C#

C# is a general-purpose, type-safe, object-oriented


programming language. It was developed around 2000
by Microsoft as part of its .NET initiative.

Comments

Comments are bits of text that are not executed. These // This is a single line comment
lines can be used to leave notes and increase the
readability of the program.
• Single line comments are created with two /* This is a multi-line comment
forward slashes // . and continues until the end
• Multi-line comments start with /* and end of comment symbol is reached */
with */ . They are useful for commenting out
large blocks of code.

Console.WriteLine()

The Console.WriteLine() method is used to Console.WriteLine("Hello, world!");


print text to the console. It can also be used to print
other data types and values stored in variables.
// Prints: Hello, world!

1 of 2 11/01/2024, 18:48
Firefox about:srcdoc

.NET Platform

.NET is a free, cross-platform, open source developer


platform for building many di�erent types of
applications.
With .NET, you can use multiple languages, editors, and
libraries to build for web, mobile, desktop, gaming, and
IoT. Whether you’re working in C#, F#, or Visual Basic,
your code will run natively on any compatible OS.
Di�erent .NET implementations handle the heavy lifting
for you.

Print Share

2 of 2 11/01/2024, 18:48

You might also like