fbpx

Latest Posts On Code Maze

Code Maze Weekly #141

Code Maze Weekly #141

Issue #141 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks ASP.NET Core rate limiting middleware in .NET 7 [blog.maartenballiauw.be] With .NET 7 we're finally getting the in-build rate-limiting middleware. Let's see...

Counting Occurrences of a Char Within a String in C#

Counting Occurrences of a Char Within a String in C#

In this article, we are going to learn how to count occurrences of a char within a string in C#. A string is a sequence of characters and we essentially iterate over it to count the number of occurrences of any character within it. [sc name="github"...

Code Maze Weekly #140

Code Maze Weekly #140

Issue #140 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks How to take an ASP.NET Core website “Down for maintenance” [www.thereformedprogrammer.net] If you ever need to take the site offline for maintenance, here's a...

Using Query String Parameters with Minimal APIs

Using Query String Parameters with Minimal APIs

In this article, we are going to explain how we can work with query string parameters in Minimal APIs in .NET 6. You may refer here for a nice introduction to the concept of Minimal APIs. Also, we will show new improvements that .NET 7 brings to the table. [sc...

AutoMapper vs Mapster in .NET

AutoMapper vs Mapster in .NET

In this article, we are going to compare the popular object mapping libraries AutoMapper and Mapster. Later, we'll do a performance benchmark to find the most performant one. [sc name="github"...

What is NullReferenceException in C#?

What is NullReferenceException in C#?

In C#, a NullReferenceException occurs when we try to access a variable whose value has not been set or has been set to null. It can be easy to trigger this exception accidentally, so it's important to be aware of how to avoid it in the first place. In this article,...

FileSystemWatcher in C#

FileSystemWatcher in C#

.NET provides a handy way to deal with monitoring different file system changes. In this article, we will discuss what FileSystemWatcher is, how to set it up, and how to configure it to observe various file system changes. In addition, we will take a look at the...

Code Maze Weekly #139

Code Maze Weekly #139

Issue #139 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks How to download files from ASP.NET Core MVC [blog.elmah.io] If downloading files in ASP.NET Core MVC is something you're planning to implement, or have had...

Indexers in C#

Indexers in C#

In this article, we are going to learn about Indexers in C#, how to declare them in a class, struct, or interface, and overload them. We're also going to learn what the differences between indexers and properties are. [sc name="github"...

Return File in ASP.NET Core Web API

Return File in ASP.NET Core Web API

In this article, we are going to learn how to return a file in an ASP.NET Core Web API and some concepts behind it. That said, we are going to implement a simple Web API to read a local file and return this file to download. [sc name="github"...

Improving Unit Tests with Fluent Assertions

Improving Unit Tests with Fluent Assertions

Unit tests are usually a must-have part of building and maintaining a software application. Fluent Assertions is a wonderful library of extension methods. Due to the nature of the library, the code reads like a written sentence. In this article, we will review many...

Code Maze Weekly #138

Code Maze Weekly #138

Issue #138 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Customize The Authorization Pipeline In ASP.NET Core [khalidabuhakmeh.com] Although ASP.NET Core comes with powerful authorization features, that makes it...

Feature Flags in ASP.NET Core

Feature Flags in ASP.NET Core

Being able to conditionally enable or disable features in our applications without redeploying our code is a powerful tool that we can take advantage of to quickly iterate on new features in our applications. In this article, we are going to learn about Feature Flags...

Any() vs Count() in .NET: Which One is Better?

Any() vs Count() in .NET: Which One is Better?

In this article, we are going to learn the main differences between Any and Count methods from LINQ. We work with different collections in C# all the time, and we often need to check if there are any records inside the collection or if it is empty. Both methods can...

Code Maze Weekly #137

Code Maze Weekly #137

Issue #137 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Secure ASP.NET Core GRPC API hosted in a Linux kestrel Azure App Service [damienbod.com] If you've tried to implement a secure GRPC API service in ASP.NET Core...

How to Test a REST API with .NET and xUnit

How to Test a REST API with .NET and xUnit

In this article, we are going to cover how and why we should test a REST API with .NET and xUnit. We'll discuss why this is important, and how to actually test various components of an API response to ensure requirements are being met. [sc name="github"...

Getting Started With Mapster in ASP.NET Core

Getting Started With Mapster in ASP.NET Core

In this article, we're going to learn how to use Mapster in ASP.NET Core applications. First, we'll learn what Mapster is and how we can install it inside the .NET Core application. Then, we are going to try different options for mapping data when using Mapster. After...

Using Generics in C#

Using Generics in C#

Generic programming is a powerful tool that C# offers to developers. In this article, we'll take a look at how generics work in C# and some of the benefits they provide. We'll also see how to use generics with classes, methods, and delegates. Finally, we'll look at...