Module 2: C# Basics
Core programming concepts and syntax fundamentals.
Duration: 90 minutes
Learning Objectives
- • Understand variables and data types in C#
- • Learn to use control structures (if/else, loops, switch)
- • Define and call methods
- • Understand basic class structure
- • Perform basic debugging in Visual Studio Code
Key Topics
Variables and Data Types
Understanding how to store and manipulate different types of data.
int age = 25; string name = "John"; bool isStudent = true; double salary = 50000.50;
Control Structures
Making decisions and repeating actions in your code.
if (age >= 18)
{
Console.WriteLine("Adult");
}
else
{
Console.WriteLine("Minor");
}
for (int i = 0; i < 5; i++)
{
Console.WriteLine($"Count: {i}");
}Methods and Classes
Organizing code into reusable blocks and object blueprints.
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public void DisplayInfo()
{
Console.WriteLine($"Name: {Name}, Age: {Age}");
}
}Basic Debugging
Using breakpoints and stepping through code to find and fix errors.
Hands-on Exercises
Exercise 1: Simple Calculator
Create a calculator that performs basic arithmetic operations (+, -, *, /).
Exercise 2: Student Grade Calculator
Write a program that determines student grade based on marks (A, B, C, D, F).
Exercise 3: Number Guessing Game
Create a game where users guess a random number between 1-100.
← Back to C# Training
Module 2 of 9