Roadmap .NET-DEVELOPER
Roadmap .NET-DEVELOPER
✅ Learn C#
Variables
A variable is a named storage location in memory that holds a value. In C#, you declare variables using a specific
data type.
csharp
int age = 25; // Integer typedouble salary = 50000.50; // Floating pointstring name = "John";
// Text databool isActive = true; // Boolean (true/false)
Data Types
C# has different data types, categorized into value types and reference types:
Operators
• Arithmetic Operators: +, -, *, /, %
• Comparison Operators: ==, !=, >, <, >=, <=
• Logical Operators: &&, ||, !
Example:
csharp
int a = 10, b = 5;int sum = a + b; // 15bool isGreater = a > b; // true
if-else Statement
csharp
..
int number = 10;if (number > 0)
{
Console.WriteLine("Positive number");
}else
{
Console.WriteLine("Negative number");
}
switch Statement
csharp
..
int day = 3;switch (day)
{
case 1:
Console.WriteLine("Monday");
break;
case 2:
Console.WriteLine("Tuesday");
break;
default:
Console.WriteLine("Another day");
break;
}
for Loop
csharp
..
for (int i = 1; i <= 5; i++)
{
Console.WriteLine("Iteration: " + i);
}
while Loop
csharp
..
int count = 1;while (count <= 5)
{
Console.WriteLine("Count: " + count);
count++;
}
do-while Loop
csharp
..
int num = 1;do
{
Console.WriteLine("Number: " + num);
num++;
} while (num <= 5);
csharp
..
string[] fruits = { "Apple", "Banana", "Cherry" };foreach (string fruit in fruits)
{
Console.WriteLine(fruit);
}
csharp
..
void Greet()
{
Console.WriteLine("Hello, World!");
}
csharp
..
int Add(int a, int b) { return a + b; }double Add(double a, double b) { return a + b; }
csharp
..
class Car
{
public string model;
public int year;
4.2 Inheritance
csharp
..
class Animal
{
public void Eat()
{
Console.WriteLine("Eating...");
}
}
class Dog : Animal
{
public void Bark()
{
Console.WriteLine("Barking...");
}
}
4.3 Polymorphism
csharp
..
class Animal
{
public virtual void MakeSound()
{
Console.WriteLine("Animal sound...");
}
}
class Dog : Animal
{
public override void MakeSound()
{
Console.WriteLine("Woof Woof!");
}
}
csharp
..
class BankAccount
{
private double balance = 0;
• Introduced in 2016, .NET Core was a complete redesign of .NET with cross-platform support.
• Modular: Instead of being a monolithic framework, it allows developers to include only necessary libraries via NuGet packages.
• Performance improvements: It is faster than .NET Framework due to enhancements in the runtime.
• It is open-source and maintained by Microsoft and the community.
Final version: .NET Core 3.1 (Now merged into .NET 5).
• Introduced in 2020, .NET 5 unified .NET Core and .NET Framework into a single platform.
• The latest versions are .NET 6, .NET 7, and .NET 8 (LTS - Long Term Support).
• Supports all application types, including:
Current LTS version: .NET 8 (Released in 2023, supported until 2026). Next version: .NET 9
(Expected in 2024).
1. Memory Management (Garbage Collection) – Automatically manages memory by removing unused objects.
2. Code Execution – Executes .NET applications efficiently.
3. Security – Enforces code access security and prevents unauthorized operations.
4. Exception Handling – Provides a structured approach to error handling.
5. Just-In-Time (JIT) Compilation – Converts CIL (Common Intermediate Language) into machine code at runtime.
1.
C# Code Compilation
2.
3.
o At runtime, the CLR converts CIL into native machine code specific to the operating system.
"Hello, World!"
call void [System.Console]::WriteLine(string)
ret
4. Summary
• .NET Framework: Windows-only, legacy applications, no new features.
• .NET Core: Cross-platform, modern, modular, last version was 3.1.
• .NET 5+: Unified, cross-platform, high-performance, actively maintained.
• CLR (Common Language Runtime): Manages execution, memory, security, and JIT compilation.
• CIL (Common Intermediate Language): Intermediate compiled code that the CLR converts into native machine code.
git --version
After installation, set up your name and email (used for commits):
git init
This creates a .git folder inside the directory, initializing the repository.
If you want to work on an existing project hosted on GitHub/GitLab, you can clone it.
When you make changes in your project, Git tracks them. You need to stage and commit them.
git status
git add .
What is a Commit?
A commit is a snapshot of your project at a certain point in time.
If other developers made changes to the remote repository, you can fetch and merge them into your local project.
or (Git 2.23+)
Once your feature is complete, merge it back into the main branch.
Delete a Branch
After initializing Git locally (git init), link it to the GitHub repository:
git remote -v
git log
6. Summary of Commands
Command Description
git init Initialize a new repository
git clone URL Clone a repository from GitHub/GitLab
git status Check status of changes
git add . Add all changes to the staging area
git commit -m "Message" Save changes to the local repository
git push origin main Upload commits to GitHub
git pull origin main Get latest changes from remote
git branch feature-branch Create a new branch
git checkout feature-branch Switch to a branch
git merge feature-branch Merge a branch into main
git log View commit history
git reset --soft HEAD~1 Undo the last commit (keep changes)
Phase 2: Advanced C# & .NET Concepts (3-6 months)
✅ Advanced C# Concepts
1. Collections in C#
Collections in C# provide a way to store and manipulate groups of objects. The System.Collections.Generic
namespace provides type-safe collections.
Console.WriteLine(studentScores["Alice"]); // Output: 95
• First-In-First-Out collection.
Queue<string> tasks = new Queue<string>();
tasks.Enqueue("Task1");
tasks.Enqueue("Task2");
Console.WriteLine(tasks.Dequeue()); // Output: Task1
• Last-In-First-Out collection.
3.2 Events in C#
Events allow loose coupling between components.
class Button
{
public event Action OnClick;
4. Asynchronous Programming
Asynchronous programming improves performance by allowing non-blocking execution.
5.1 Try-Catch-Finally
try
{
int result = 10 / 0; // Division by zero
}catch (DivideByZeroException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}finally
{
Console.WriteLine("Execution completed.");
}
using Serilog;
class Program
{
static void Main()
{
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.CreateLogger();
Log.Information("Application started!");
}
}
6. Summary
Collections – Lists, Dictionaries, Queues, Stacks.
LINQ – Query collections easily with .Where(), .Select(), .OrderBy().
Delegates & Events – Pass functions as parameters and handle events.
Lambda Expressions – Short, inline functions.
Async Programming – Use async/await for non-blocking operations.
Exception Handling & Logging – Handle errors and log information.
Component Description
Model Represents data and business logic.
View Handles UI and presentation logic.
Controller Manages user requests and response handling.
MyApp/
│-- Controllers/
│ │-- HomeController.cs
│-- Models/
│ │-- Product.cs
│-- Views/
│ │-- Home/
│ │-- Index.cshtml
│-- wwwroot/
│-- Program.cs
│-- appsettings.json
csharp
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
Example: Views/Home/Index.cshtml
html
@{
ViewData["Title"] = "Home Page";
}<h1>Welcome to My Website</h1><p>Today's date: @DateTime.Now.ToShortDateString()</p>
A layout defines a common structure for all views (like a master page).
Example: Views/Shared/_Layout.cshtml
<!DOCTYPE html><html><head>
<title>@ViewData["Title"]</title></head><body>
<header><h1>My Website</h1></header>
<main>@RenderBody()</main>
<footer>© 2025</footer></body></html>
@{
Layout = "_Layout";
}
html
<a asp-controller="Home" asp-action="About">About</a>
This generates:
html
<a href="/Home/About">About</a>
html
<form asp-controller="Account" asp-action="Login">
<input type="text" name="username" />
<button type="submit">Login</button></form>
builder.Services.AddScoped<IProductService, ProductService>();
7. Summary
MVC Architecture – Models (Data), Views (UI), Controllers (Logic).
Razor Views – Use .cshtml with C# and HTML.
Layouts & Tag Helpers – Shared templates and dynamic elements.
Dependency Injection – Inject services for scalability.
Middlewares – Custom logic in request pipelines.
Filters – Custom logic before or after actions.
✅ .NET API Development (RESTful APIs with ASP.NET Core Web API)
.NET API Development (RESTful APIs with ASP.NET Core Web API)
• Open Visual Studio and create a new ASP.NET Core Web API project.
• Choose .NET version and configure settings.
• The project structure will include:
o Controllers/ (where API controllers are defined)
o Program.cs (entry point for configuration)
o appsettings.json (configuration file)
o Models/ (for data models)
o Data/ (for database context, if using Entity Framework)
Example: ProductsController.cs
[ApiController]
[Route("api/[controller]")]
[HttpGet]
return Ok(products);
}
•
o HttpGet → Handles GET requests.
o Ok(products) → Returns 200 OK response with data.
Configure Program.cs:
Csharp
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
options.Authority = "https://your-auth-server/";
options.Audience = "your-api";
});
C sharp
builder.Services.AddAuthentication()
.AddGoogle(options =>
{
options.ClientId = "your-client-id";
options.ClientSecret = "your-client-secret";
});
3. Swagger Documentation
Step 1: Install Swagger
• En
ab
le
S
w
ag
ge
r
in
P
r
o
g
r
a
m
.
c
s:
•
csharp
•
•
..
•
•
builder.Services.AddSwaggerGen();
•
•
•
csharp
app.UseSwagger();
app.UseSwaggerUI();
• Run the API and visit https://localhost:5001/swagger to see the documentation.
/// <summary>
/// Retrieves all products.
/// </summary>
[HttpGet]
public IActionResult GetProducts()
{
return Ok(products);
}
Conclusion
• Install Microsoft SQL Server and SQL Server Management Studio (SSMS).
• Create a new database:
sql
CREATE DATABASE MyDatabase;
• Create a table:
sql
CREATE TABLE Products (
Id INT PRIMARY KEY IDENTITY,
Name NVARCHAR(100),
Price DECIMAL(10,2)
);
Insert data:
sql
INSERT INTO Products (Name, Price) VALUES ('Laptop', 999.99);
• Select data:
sql
SELECT * FROM Products;
sql
CREATE PROCEDURE GetProductsASBEGIN
SELECT * FROM Products;END;
Execute the stored procedure:
sql
EXEC GetProducts;
csharp
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools
csharp
public class AppDbContext : DbContext
{
public DbSet<Product> Products { get; set; }
csharp
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
pgsql
dotnet ef migrations add InitialCreate
dotnet ef database update
Insert a record:
csharP
using var context = new AppDbContext();
context.Products.Add(new Product { Name = "Phone", Price = 799.99M });
context.SaveChanges();
Retrieve data:
csharp
csharp
dotnet add package MongoDB.Driver
csharp
var client = new MongoClient("mongodb://localhost:27017");var database =
client.GetDatabase("MyMongoDb");var collection =
database.GetCollection<Product>("Products");
Csharp
var product = new Product { Name = "Tablet", Price = 499.99M };
collection.InsertOne(product);
Retrieve documents:
csharp
Redis (Caching)
csharp
dotnet add package StackExchange.Redis
Create a connection:
csharp
var redis = ConnectionMultiplexer.Connect("localhost");var db = redis.GetDatabase();
csharp
Conclusion
HTML is the backbone of web pages, defining structure using elements like:
html
<!DOCTYPE html><html><head>
<title>My Website</title></head><body>
<h1>Welcome</h1>
<p>This is a paragraph.</p>
<a href="https://example.com">Click me</a></body></html>
• <h1> → Headings
• <p> → Paragraphs
• <a> → Links
• <img> → Images
css
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
h1 {
color: blue;
text-align: center;
}
html
<button onclick="showMessage()">Click Me</button><script>
function showMessage() {
alert("Hello, World!");
}</script>
jsx
function App() {
return <h1>Hello from React!</h1>;
}export default App;
React features:
• Reusable components
• Virtual DOM for speed
• State management with hooks
typescript
@Component({
selector: 'app-root',
template: `<h1>Hello from Angular!</h1>`
})export class AppComponent { }
Angular uses:
• TypeScript
• Two-way data binding
• Built-in form validation
razor
@page "/"
<h1>Hello from Blazor!</h1>
<button @onclick="ShowMessage">Click Me</button>
@code {
void ShowMessage() {
Console.WriteLine("Blazor button clicked!");
}
}
Blazor features:
• C# instead of JavaScript
• Component-based architecture
• Tight integration with .NET backend
javascript
fetch("https://api.example.com/products")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
jsx
import { useEffect, useState } from "react";
function Products() {
const [products, setProducts] = useState([]);
useEffect(() => {
fetch("https://api.example.com/products")
.then(res => res.json())
.then(data => setProducts(data));
}, []);
return (
<ul>
{products.map(p => <li key={p.id}>{p.name}</li>)}
</ul>
);
}
typescript
import { HttpClient } from '@angular/common/http';
constructor(private http: HttpClient) {}
getProducts() {
this.http.get<Product[]>('https://api.example.com/products')
.subscribe(products => console.log(products));
}
razor
@code {
private List<Product> products = new();
4. Summary
HTML, CSS, JavaScript – Core frontend technologies.
React, Angular, Blazor – Choose a frontend framework.
Consuming APIs – Fetch data in frontend apps.