Back-end

21 posts

2021

How to Kill a Thread - C#

How to kill a thread in C# using Thread.Abort() and handle ThreadAbortException safely.

How to Use OfType in LINQ - C#

How to use OfType in LINQ to filter a collection by type in C#, with practical examples.

How to Use SelectMany in LINQ - C#

How to use SelectMany in LINQ to flatten nested collections in C#, with real-world examples.

How to Use Where in LINQ - C#

How to use Where in LINQ to filter collections in C#, with method syntax and query syntax examples.

How to Use Select in LINQ - C#

How to use Select in LINQ to transform collections in C#, with method syntax and query syntax examples.

How to Hash a String - C#

How to hash a string in C# using MD5, SHA256, and other algorithms from System.Security.Cryptography.

How to Use Implicit and Explicit Casting - C#

The difference between implicit and explicit casting in C#, with examples of when each is needed.

How to Box and Unbox Variables - C#

Boxing and unboxing in C# explained. How value types convert to reference types and back again.

How to Throw Multiple Exceptions at Once, Using AggregateException - C#

How to throw multiple exceptions at once in C# using AggregateException to batch validation errors.

Why am I getting this exception? - C#

The 15 most common C# exceptions you'll encounter, with explanations and when each one is thrown.

How to detect if Powershell is installed - C#

How to check if PowerShell is installed on a Windows machine before running scripts from C#.

How to handle inner exceptions - C#

How to access and handle inner exceptions in C# using the InnerException property.

Catching the base class of an exception - C#

How to catch multiple exception types in C# using a single catch block for the base Exception class.

How to create custom exceptions - C#

How to create custom exception classes in C# by inheriting from the Exception base class.

Using finally after catching exceptions - C#

How try, catch, and finally blocks work together in C# to handle exceptions and clean up resources.

How to re-throw an exception - C#

How to rethrow an exception in C# without losing the original stack trace, using throw vs throw ex.

How to catch exceptions - C#

How to catch exceptions in C# using try-catch blocks, with examples for handling specific exception types.

How to throw exceptions - C#

How to throw exceptions in C# using the throw keyword, with examples for different exception types.

Creating asynchronous tasks, using async and await - C#

How to use async and await in C# to write non-blocking code, with practical examples.

Chaining Tasks with Continuation Tasks - C#

How to chain async operations in C# using ContinueWith and continuation tasks, with practical examples.

Spawn threads by using ThreadPool - C#

How to use ThreadPool in C# to reuse threads efficiently instead of creating and destroying them each time.