Built-In Rate Limiting in ASP.NET Core Web API
In this article, we’re going to discuss Rate Limiting in ASP.NET Core, specifically version 8, and explore some ways of implementing it. So,...
Represent the Relationship of Properties Using Property Mappings From AutoMapper
In this article, we'll take a look at what property mappings are and how to retrieve them from AutoMapper. AutoMapper is a free .NET library that streamlines object mapping, reducing manual coding to boost development speed and minimize the risk of errors....
Better Minimal APIs Endpoint Organization With Carter in ASP.NET Core
In this article, we'll look closely at the Carter library and how we can use it in our ASP.NET Core projects. Let's get started! What...
How to Check the Total Number of Items Defined in an Enum
In this article, we talk about enums and, more specifically, how to find the total number of items defined in the enum. But first of all, let's define an enum. [sc name="github"...
Baseline Styling in BenchmarkDotNet
In this article, we will learn how to set a baseline for our benchmark in BenchmarkDotNet and discuss styling the baseline results. As software developers, benchmarking the performance of our methods is a crucial part of our day-to-day activities. With the...
The Difference Between Invariance, Contravariance and Covariance in Generics in C#
In this article, we will explore the role, significance, usage, and impact of invariance <T>, contravariance <in T> and covariance <out T> in our C# generics programming. Generics in C# enable us to design flexible, reusable classes and methods,...
Introduction to Strawberry Shake and GraphQL in .NET
In this article, we'll get familiar with GraphQL and Strawberry Shake, a GraphQL tool that facilitates interaction with local and remote data. Subsequently, we will build an application using the .NET API, focusing on customers searching for available space in...
How to Use HttpOnly Cookie in .NET Core for Authentication and Refresh Token Actions
In this article, we will show you how to use HttpOnly Cookie in .NET Core apps to secure our JWT or JSON Web Tokens, when implementing the authentication and refresh token actions. [sc name="patreon-source-code"...
Fastest Way to Find and Extract a Number From a String in C#
This article will explore the quickest method to find and extract a number from a string in C#. We will discuss and implement different techniques for accomplishing this task. Subsequently, we will evaluate the performance of these techniques using the BenchmarkDotNet...
How to Detect if a Key is Pressed in a C# Console Application
We frequently read data from user input in our C# application. However, we sometimes need to detect a key press and continue the operation. In this article, we discuss how to detect if a key is pressed in a C# console application. By understanding the usage of these...
Improvements in the Using Directive for Additional Types in C#
The "using" directive in C# helps us reduce boilerplate code when referencing types and members that sit outside the context of our class. C# 12 further expanded on the using directive, allowing it to be used for additional types. In this article, we'll start by...
How to Test gRPC Services in ASP.NET Core
gRPC is a popular way to create fast and scalable API's in the .NET world. In this article, we explore how to test gRPC Services in .NET applications, and set up both unit and integration tests to ensure the reliability and performance of gRPC services. [sc...
How to Set a Default User-Agent on an HttpClient in ASP.NET Core
In this article, we will learn about the User-Agent header used while making HTTP calls. Then, we will understand how to set the default User-Agent on an HttpClient. [sc name="github"...
Restricting a Value Lifetime With the “scoped” Keyword in C#
In this article, we will discuss the scoped keyword in C#, explore its use case, and examine how it can be advantageous. The contextual keyword scoped in C# serves as a powerful tool for restricting the lifetime of a value. Employing the scoped modifier allows us to...
How to Validate File Upload Extensions in ASP.NET Core
In this article, we will see how we can validate file upload extensions and be certain that our applications are safe from malicious uploads. When receiving files uploaded by users, relying solely on file names to determine file types is risky. This is because we can...
Handling Circular References When Working With JSON in .NET
When working with JSON (JavaScript Object Notation) in .NET applications, developers often encounter challenges related to circular references, where objects circularly reference each other. In this article, we'll explore common scenarios involving circular...
The Best Way to Assign an Initial Value to Auto-Properties in C#
In this article, we will explore auto-properties and various ways to assign an initial value to it in C#. The C# programming...
How to Retrieve the Number of CPU Cores in C#
In the realm of C# programming, understanding the underlying hardware can be crucial for optimizing performance. One fundamental aspect is knowing the number of CPU cores available. In this article, we will explore methods to retrieve the number of CPU cores in C#,...
Present a List of Files in a Directory With Directory Browsing in ASP.NET Core
In ASP.NET Core, directory browsing is a feature that allows a web application to present a list of files in a specified directory to the user. For security, however, directory browsing is disabled by default to prevent unauthorized users from accessing a website's...
Improve Performance With Source-Generated RegEx in .NET
In this article, we'll look at source-generated RegEx and how it can improve performance in our .NET applications. ...
Scale Your Services With Service-Oriented Architecture in .NET
In this article, we will discuss the Service-Oriented Architecture in .NET. We will cover what it is, how to implement it, how it differs from Microservice Architecture, and how we can use cloud computing platforms as a jump pad to quickly stand up services and...




