Loading...

Introduction to C# and .NET

Imagine you’re using your favorite mobile app, playing a game, or logging into a website. Behind every click, every animation, and every login screen, there’s code quietly working.

One of the languages powering those experiences is C#, a modern, fast, and widely used language created by Microsoft.

In this lesson, you'll meet C# for the first time , understand where it’s used, write your very first program, and even build a small welcome-message generator.

Today is the day you start thinking like a programmer.

Welcome Message Generator

Before we learn anything else, let’s imagine a tiny app. Every time it runs, it should display a friendly welcome message:

text
4 lines
|
22/ 500 tokens
1
2
3
4
========================
   WELCOME TO C#
   Hello, Learner!
========================

You’ll write this program yourself by the end of this lesson.

What Is C# & Where Is It Used?

C# (pronounced “C Sharp”) is a modern programming language used all around the world.
Here’s where you can find it in action:

  • 🎮 Games: Unity (the world’s most popular game engine) uses C#.
  • 📱 Mobile Apps: using frameworks like Xamarin and .NET MAUI.
  • 💻 Desktop Software: Windows applications, utilities, editors.
  • 🌐 Web Applications: ASP.NET powers huge websites and APIs.
  • 🤖 Automation & Robotics: used in tools, industrial systems, and bots.

If you learn C#, you can build almost anything, from mobile apps to video games to cloud software.

Setting Up Your Coding Environment

You have two simple options:

Option 1: DevsCall AI Online Code Runner

  • No installation.
  • No setup.
  • Just open → write → run → get AI explanations.

This is the recommended way for beginners.

Option 2: VS Code (If You Want a Real IDE)

  1. Install Visual Studio Code.
  2. Install the C# extension.
  3. Create a simple .cs file.
  4. Run your program using the built-in terminal.
But remember: You can do this entire course directly inside DevsCall without installing anything.

Your First C# Program: Hello World

Here is the classic first program written in C#:

csharp
9 lines
|
28/ 500 tokens
1
2
3
4
5
6
7
8
9
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, World!");
    }
}
Code Tools

Run this in DevsCall or any C# environment, and you’ll see the message printed on screen.

How It Works

  • using System;
    Gives you access to basic features like printing text.
  • class Program
    Every C# program starts inside a class.
  • static void Main()
    The starting point of your program, the first code that runs.
  • Console.WriteLine()
    Prints text on the screen.

Once you understand this structure, you can write almost any program, calculators, games, mini-apps, anything.

Understanding Compilation & Execution

Before your program runs, something important happens behind the scenes:

  • You write code → the C# compiler checks it.
  • Compiler converts code into an intermediate language.
  • The .NET runtime executes it on your device.

In simple words:
Your code → gets translated → into something the computer understands.

This translation is why C# is powerful, fast, and secure.

Let’s Build the “Welcome Message Generator”

Here is your first real project:

csharp
12 lines
|
69/ 500 tokens
1
2
3
4
5
6
7
8
9
10
11
12
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("========================");
        Console.WriteLine("   WELCOME TO C#");
        Console.WriteLine("   Hello, Learner!");
        Console.WriteLine("========================");
    }
}
Code Tools

Run it, and your program will display a clean, formatted welcome screen.

Learn Together with AI

You don’t have to learn alone. Try these prompts in your AI Copilot:

  • “Explain each line of a C# Hello World program.”
  • “Rewrite the welcome message with different colors or ASCII art.”
  • “Show a version that also prints my name.”
  • “What else can I print using Console.WriteLine?”

AI will act like a friendly tutor who never gets tired of explaining.

Practice Time

Write a C# program that prints the following:

text
4 lines
|
24/ 500 tokens
1
2
3
4
========================
   MY FIRST C# PROGRAM
   Welcome to DevsCall!
========================

Use Console.WriteLine() just like in the examples.

Example Solution

csharp
12 lines
|
71/ 500 tokens
1
2
3
4
5
6
7
8
9
10
11
12
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("========================");
        Console.WriteLine("   MY FIRST C# PROGRAM");
        Console.WriteLine("   Welcome to DevsCall!");
        Console.WriteLine("========================");
    }
}
Code Tools

If your output matches, congratulations! You’ve officially written your first structured C# program.

Frequently Asked Questions

C# is used to build games, mobile apps, websites, desktop software, and automation tools. It's one of the most versatile programming languages today.

No. You can use the DevsCall AI Online Runner to write and run C# code instantly without installing anything.

It prints text on the screen. You’ll use it in almost every beginner-level C# program.

Yes. C# has a clean syntax, strong tooling support, and predictable structure, making it easy for beginners to learn and grow.

Absolutely! Unity, one of the world’s most popular game engines, uses C# as its primary scripting language.

Still have questions?Contact our support team