.NET

C#, dotNet Core, ASP.NET, Entity Framework, testing, architecture, and everything .NET developers need.

Aggregation and Grouping with LINQ

Summarize and organize your data

LINQ can do more than filter and sort: it can summarize and group your data. βž• Aggregation: Sum, Count, Average, Min, Max 1 2 3 4 5 6 int[] numbers = { 1, 2, 3, 4, 5 }; int sum = numbers.Sum(); ...

Filtering, Ordering, and Projecting with LINQ

Get what you want from your data

LINQ makes it easy to select, sort, and shape your data. πŸ”Ž Filtering with Where 1 var even = numbers.Where(n => n % 2 == 0); πŸ—‚οΈ Ordering with OrderBy / OrderByDescending 1 2 var sorted = na...

Introduction to LINQ

Query data easily in C#

LINQ (Language Integrated Query) lets you work with data (like arrays and lists) using simple, readable queries. πŸ“ Why Use LINQ? Write less code to filter, sort, and search data. Works with ...

Working with Databases Using ADO.NET

Connect your C# app to SQL Server

ADO.NET is the standard way to connect your C# applications to relational databases like SQL Server. πŸ”Œ Connecting to SQL Server You’ll need a connection string (ask your DBA or use SQL Server Exp...

File and Directory Operations Recap

What you’ve learned so far

Let’s review what you’ve learned about files and directories in C#. πŸ“„ File Operations Write to file: File.WriteAllText("a.txt", "Hello") Read from file: File.ReadAllText("a.txt") Write mul...

Working with Directories

Creating and managing folders in C#

Folders are called directories in C#. You can create, list, and delete them with a few commands. πŸ“‚ Create a Directory 1 Directory.CreateDirectory("myfolder"); πŸ—‚οΈ List Files and Directories 1 2...

Streams and File I/O: Advanced

More control over file reading and writing

Streams give you fine control over reading and writing data, especially large files. πŸ“€ Writing with FileStream 1 2 3 4 5 using (FileStream fs = new FileStream("data.bin", FileMode.Create)) { ...

File I/O Basics

Reading and writing files in C#

C# makes it easy to work with files: reading, writing, and creating them on your system. πŸ“ Writing to a File 1 2 3 using System.IO; File.WriteAllText("hello.txt", "Hello, file!"); πŸ“– Reading fr...

Exception Best Practices

How (and when) to use exceptions in C#

Exceptions are powerful, but you should use them wisely. βœ… Best Practices Use exceptions for exceptional cases only. Don’t use them for normal control flow. Catch only what you ...

Custom Exception Classes

Make your own error types

C# lets you create your own exception classes for specific error types. πŸ› οΈ Defining a Custom Exception 1 2 3 4 class NegativeNumberException : Exception { public NegativeNumberException(strin...