This cheat sheet is a valuable resource for anyone who wants to learn C#. It is a quick and easy way to learn about the most common C# syntax, keywords, and concepts, and it can help you to write efficient and robust applications.
C# (pronounced C sharp) is a programming language developed by Microsoft and widely used for building various applications, including desktop, web, and mobile applications. With C#, you can create dynamic and functional programs using its rich features and libraries. By referring to a C# cheat sheet, you can quickly grasp the language's fundamental syntax, keywords, and concepts. This will enable you to write clean, maintainable code that performs well, enhancing the overall quality of your applications.
This cheat sheet is a valuable resource for anyone who wants to learn C#. It is a quick and easy way to learn about the most common C# syntax, keywords, and concepts, and it can help you to write efficient and robust applications.
C# (pronounced C sharp) is a programming language developed by Microsoft and widely used for building various applications, including desktop, web, and mobile applications. With C#, you can create dynamic and functional programs using its rich features and libraries. By referring to a C# cheat sheet, you can quickly grasp the language's fundamental syntax, keywords, and concepts. This will enable you to write clean, maintainable code that performs well, enhancing the overall quality of your applications.
int: Represents whole numbers.
double: Represents floating-point numbers with double precision.
char: Represents a single character.
string: Represents a sequence of characters.
bool: Represents a Boolean value (true or false).
Declaration: <data_type> <variable_name>; Example: int age;
Arithmetic Operators:
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo
Comparison Operators:
== Equal to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
Assignment Operators:
= Assigns a value to a variable
+= Adds and assigns
-= Subtracts and assigns
*= Multiplies and assigns
/= Divides and assigns
if-else Statement: if (<condition>) { // Code to execute if the condition is true } else { // Code to execute if the condition is false }
for Loop: for (<initialization>; <condition>; <increment>) { // Code to execute repeatedly }
while Loop: while (<condition>) { // Code to execute repeatedly while the condition is true }
Declaration: <access_modifier> <return_type> <method_name>(<parameter_list>)
Example: public int AddNumbers(int num1, int num2) { int sum = num1 + num2; return sum; }
Declaration: class <class_name> {}
Example: public class Person { public string Name { get; set; } public int Age { get; set; } }
Example: try { // Code that may throw an exception } catch (Exception ex) { // Code to handle the exception } finally { // Code that always executes, regardless of whether an exception occurred or not }
Learn more C# skills on Coursera.
C# Courses | Unity Courses | Game Development Courses | .NET Courses | Object Oriented Programming Courses | Programming Fundamentals Courses | Game Design Courses | Software Development Courses | Algorithms Courses | C++ Courses | SQL Courses
Can’t decide what is right for you?
Try the full learning experience for most courses free for 7 days.Register to learn with Coursera’s community of 87 million learners around the world