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

Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
  • Get started by writing code examples to learn the basics of the C# syntax.

    After you complete this module, you'll be able to:

    • 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

  • Use data in your applications by creating literal values and variable values of different data types.

    After you complete this module, you'll be able to:

    • 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

  • Learn the operators and techniques used to perform basic math operations on numeric data.

    After you complete this module, you'll be able to:

    • Perform mathematical operations on numeric values

    • Observe implicit type conversion between strings and numeric values

    • Temporarily convert one data type into another

  • Learn to branch your code's execution path by evaluating Boolean expressions.

    In this module, you will:

    • Write code that evaluates conditions using if, else, and else if statements.

    • Build Boolean expressions to evaluate a condition.

    • Combine Boolean expressions using logical operators.

    • Nest code blocks within other code blocks.

Syllabus

  • Write your first C# code
    • Introduction
    • Display console output
    • Accept user input
    • Manipulate strings
    • Exercise - Create a personalized greeting
    • Challenge - Create a program with user interaction
    • Module assessment
    • Summary
  • Store data with variables in C#
    • Introduction
    • Work with literal values
    • Declare and assign variables
    • Use the var keyword
    • Exercise - Work with literals and variables
    • Module assessment
    • Summary
  • Perform basic operations on numbers in C#
    • Introduction
    • Work with numeric data types
    • Perform math operations
    • Convert data types
    • Exercise - Build a tip calculator
    • Challenge - Convert Fahrenheit to Celsius
    • Module assessment
    • Summary
  • Add decision logic to your code in C#
    • Introduction
    • Evaluate conditions with Boolean expressions
    • Control code flow with if, else if, and else
    • Combine conditions with logical operators
    • Exercise - Build a dice game
    • Challenge - Display a subscription renewal message
    • Module assessment
    • 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
    3
    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
    1
    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.