.NET
A collection of 73 posts

Validate Settings Using The IOptions Pattern in .NET
· Christian Schou Køster

Avoid Complexity with the State Design Pattern in .NET
Struggling with complex if-else chains in your growing codebase? Let me show you how the state design pattern can simplify logic, boost maintainability, and make your code easier to scale—with a practical, real-world example of a document flow.
· Christian Schou Køster

How To Achieve High-Performance Logging in .NET
Traditional .NET logging can slow your app. Switch to LoggerMessage delegates for better performance or leverage source-generated logging (in .NET 6+) for minimal runtime costs and cleaner code. Boost efficiency, reduce overhead, and log like a pro! 🚀
· Christian Schou Køster

Use JsonSerializer to Pretty-Print JSON in .NET
Formatting JSON as plain text with proper indentation can make it much easier to include in emails or other readable contexts. Here's a quick tip/guide on how to achieve that in .NET.
· Christian Schou Køster

Use nameof to Keep Code Refactoring-Safe
Using nameof in .NET helps make code more maintainable and resilient to refactoring. It returns names as strings tied to code directly, improving readability, refactoring safety, and compile-time error checking.
· Christian Schou Køster

Enhance String Semantics with the StringSyntax Attribute
Learn how to use the StringSyntax attribute in .NET to clarify string formats like DateTime, JSON, or Regex, enhancing readability, IDE support, and reducing errors when writing .NET or C# code ✌️
· Christian Schou Køster

How To Connect A .NET Web API With A .NET MVC Web App?
With the world heading more and more into container services, we are changing applications into APIs communicating with each other. In this tutorial, you will learn how to connect a .NET Web API with a .NET MVC Web Application and nicely present the data with Bootstrap.
· Christian Schou Køster

How To Validate URLs With C#
Learn how to validate URLs using C# with some of my code snippets in this C# tutorial and see what options is best in terms of performance.
· Christian Schou Køster

The New Data Annotations in .NET 8
The latest LTS version, .NET 8, introduces new DataAnnotations for enhanced validation of strings and numbers. This article explores these annotations and shows you how to use them i practice.
· Christian Schou Køster

How To Improve Query Performance Using EF Core Query Splitting
In the market for optimizing your database queries using EF Core? In this tutorial I will show you a practical example of using Query Splitting, the results in SQL and give you a heads up before implementing it in your application.
· Christian Schou Køster

How to use DTOs the right way in .NET
· Christian Schou Køster

How to use Mapster with .NET 7 - A Quick Introduction
Learn how to use Mapster with C# and .NET in this short but explanatory tutorial.
· Christian Schou Køster

What Are The SOLID Principles? The Art Of Writing Clean And Maintainable Code in C#
· Christian Schou Køster

Logging in .NET - A Guide to LoggerFactory and Microsoft.Extensions.Logging with C#
Discover the art of logging in .NET Core apps! This tutorial covers best practices, advanced techniques, and testing for effective monitoring and debugging.
· Christian Schou Køster

Supercharge Your C# Classes - A guide to the Sealed Keyword for Better Code Control
· Christian Schou Køster

Email Regex in C#
Looking for regular expressions to validate an email or extract an email from a string in C#? In this short tutorial, I will show you how to validate and extract emails in C# using Regex.
· Christian Schou Køster

Observer Design Pattern - A Beginner's Guide with an Airport Baggage System
Are you in the market for learning how to implement the Observer Design Pattern? This tutorial will show you how to apply this pattern with C# and diagrams to make your understanding even better.
· Christian Schou Køster

C# Casing methods 101 - Mastering the different casing conventions
Mastering the different casing conventions and when to use them can make your code more readable and easier to understand for yourself and others. In this post, you will learn how and when to use the different casing methods.
· Christian Schou Køster

Simplify API Requests in .NET with HttpClientFactory: A Step-by-Step Guide
· Christian Schou Køster

How to retrieve values from IConfiguration in .NET
· Christian Schou Køster

What is .AsNoTracking() and how can it make your code perform better?
· Christian Schou Køster

Best Practices for C# - Coding Standards
This blog post outlines best practices for C# coding standards, covering class and variable naming, enums, and more. Improve your code consistency and readability with these tips.
· Christian Schou Køster

How to Set Up an Nginx Web Server with Docker Compose and Use it as a Reverse Proxy for .NET Web APIs with SSL and load balancing
Learn how to create an Nginx web server with Docker Compose, configure it with environment files, and use it as a reverse proxy for .NET Web APIs. Secure it with HTTPS and implement load balancing for high availability.
· Christian Schou Køster

Facade Pattern - C# Design Patterns
Learn how to use the Facade design pattern in C# to simplify a complex system and provide a unified interface to clients.
· Christian Schou Køster

Properly Formatting IF Statements in Your C# Code
· Christian Schou Køster

Concurrency, Parallelism, and Asynchronous Programming in .NET - What is The Difference?
Your complete guide to discovering the nuances of concurrency, parallelism, and async in .NET. Learn key differences & see code examples to enhance performance & responsiveness in your applications.
· Christian Schou Køster

The Ultimate Cheat Sheet for C#
Looking to improve your C# programming skills? Look no further than this C# ultimate cheat sheet! Covering everything from the basics to advanced features, with real-world code examples. Learn object-oriented programming, collections, exception handling, file I/O, LINQ, multithreading, and more...
· Christian Schou Køster

How to convert any list to a string with C#
Converting a list to a string is a common task in C# programming. Whether you need to display the contents of a list in a user interface or pass a list to a web service, knowing how to convert a list to a string is a fundamental skill for any C# developer.
· Christian Schou Køster

How to use MassTransit in .NET Core with RabbitMQ
· Christian Schou Køster

How to Connect MySQL Database with Entity Framework Core in .NET
· Christian Schou Køster