Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Microsoft

Write your first code using C# (Get started with C#, Part 1)

Microsoft via Microsoft Learn

Overview

  • Module 1: Get started by writing tiny code examples to learn the basics of the C# syntax!
  • In this module, you will:

    • Write your first lines of C# code
    • Use two different techniques to print a message to a text console
    • Diagnose errors when you type code incorrectly
    • Identify different C# syntax elements like operators, classes, and methods
  • Module 2: Use data in your applications by creating literal values and variable values of different data types.
  • In this module, you will:

    • Create literal values for five basic data types
    • Declare and initialize variables
    • Retrieve and set values in variables
    • Allow the compiler to determine the data type for your variable when initializing
  • Module 3: Combine literal and variable text data that are filled with special characters, formatting, and Unicode into meaningful messages for the end user.
  • In this module, you will:

    • Create string data containing tabs, new lines, and other special characters
    • Create string data containing Unicode characters
    • Combine string data into a new string value via concatenation
    • Combine string data into a new string value via interpolation
  • Module 4: Learn the operators and techniques used to perform basic math operations on numeric data.
  • In this module, you will:

    • Perform mathematical operations on numeric values
    • Observe implicit type conversion between strings and numeric values
    • Temporarily convert one data type into another
  • Module 5: Use functionality in the .NET Class Library by calling methods that return values, accept input parameters, and more.
  • In this module, you will:

    • Write code that calls stateless methods in the .NET Class Library
    • Create a new instance of .NET Class Library classes to call methods that maintain state
    • Use Intellisense to learn more about a method, its overloaded versions, its return value data type, and its input parameter data types
    • Use docs.microsoft.com to research what a method does, its overloaded versions, its return value type, its input parameters and what each parameter represents, and more
  • Module 6: Learn to branch your code's execution path by evaluating boolean expressions.
  • In this module, you will:

    • write code that evaluates conditions using the if-elseif-else statements
    • build boolean expressions to evaluate a condition
    • combine boolean expressions using logical operators
    • nest code blocks within other code blocks
  • Module 7: Work with sequences of related data in data structures known as arrays. Then, learn to iterate through each item in the sequence.
  • In this module, you will:

    • Create and initialize a new array
    • Set and get values in arrays
    • Iterate through each element of an array using the foreach statement
  • Module 8: Write code that is easier to read, update and support using naming conventions, comments and whitespace.
  • In this module, you will:

    • Choose a descriptive name for variables that describe their purpose and intent.
    • Use code comments to temporarily instruct the compiler to ignore lines of code.
    • Use code comments to describe higher-level requirements or purpose for a passage of code.
    • Write code that effectively uses whitespace to convey the relationship of lines of code.

Syllabus

  • Module 1: Write your first C# code
    • Introduction
    • Exercise - "Hello World!"
    • How it works
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 2: Store and retrieve data using literal and variable values in C#
    • Introduction
    • Exercise - Literal values
    • Declare variables
    • Exercise - Setting and getting values from variables
    • Implicitly typed local variables
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 3: Perform basic string formatting in C#
    • Introduction
    • Exercise - Character Escape Sequences and Verbatim Strings
    • Exercise - String Concatenation
    • Exercise - String Interpolation
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 4: Perform basic operations on numbers in C#
    • Introduction
    • Exercise - Simple Addition and Implicit Data Conversion
    • Exercise - Math Operators
    • Exercise - Increment and Decrement Values
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 5: Call methods from the .NET Class Library using C#
    • Introduction
    • Introducing the .NET Class Library
    • Calling different kinds of methods in the .NET Class Library
    • Work with return values and input parameters
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 6: Add decision logic to your code using the if-elseif-else statement in C#
    • Introduction
    • Exercise - Use the if statement
    • Exercise - Using the else if and else statements
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 7: Store and iterate through sequences of data using Arrays and the foreach statement in C#
    • Introduction
    • Exercise - Array Basics
    • Exercise - foreach Statement
    • Challenge
    • Solution
    • Knowledge Check
    • Summary
  • Module 8: Create readable code with conventions, whitespace, and comments in C#
    • Introduction
    • Choose variable names that follow the rules and conventions
    • Exercise - Comment your code
    • Exercise - Use whitespace
    • Challenge
    • Solution
    • Knowledge check
    • Summary

Reviews

4.8 rating, based on 4 Class Central reviews

Start your review of Write your first code using C# (Get started with C#, Part 1)

  • Profile image for Han Lynn Aung
    Han Lynn Aung
    Great course for beginners! I learnt it from this course many things about C#.Now, I can begin my learning journey about C# and more.…
  • Profile image for Fatemah Noor
    Fatemah Noor
    I recently started the "Write your first code using C# (Get started with C#, Part 1)" course on Microsoft Learn, and it has been a fantastic introduction to C#. The course content is well-structured and easy to follow, making it perfect for beginners. The interactive exercises and step-by-step guidance have helped me grasp the basics of C# programming quickly. I appreciate the practical examples and the clear explanations provided by the instructors. Overall, this course is an excellent starting point for anyone looking to learn C#. Highly recommended!
  • the course was very nice, it was very useful especially for the beginners, thanks to everyone who contributed
  • Harsh
    IT GIVE KNOWLEDGE IN A SIMPLE MANNERDS AND HELPS A LOT TO LEARN BASIC CONCEPTS

    ..........................................................................................................................................................................................

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.