Latest Posts On Code Maze

Code Maze Weekly #168

Code Maze Weekly #168

Issue #168 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Looking at C# 12 Proposals and Beyond [michaelscodingspot.com] Let's find out what C# has in store for us going forward. Let's take a look at features like...

How to Declare an Empty Array in C#

How to Declare an Empty Array in C#

In this article, we are going to look at the numerous ways to declare an empty array in C#. Arrays are used to store multiple variables of the same type. Sometimes our solution design may require the use of an empty array. For example, as an initial value for a...

How to Write Logs From Startup.cs/Program.cs in .NET

How to Write Logs From Startup.cs/Program.cs in .NET

Why should we write logs from the startup of an application? Usually, we write logs from various application events and user interactions. These are to record what activities the user performs, what data the app deals with, etc. When something goes wrong with our...

How to Remove All Whitespace Characters From a String in C#?

How to Remove All Whitespace Characters From a String in C#?

In this article, we're going to look at removing all whitespace characters from a string in C#. Strings often have leading or trailing whitespace that we would like to remove, or we may even want to remove all whitespace in between. Let's take a look at several ways...

Null-Conditional Operators in C#

Null-Conditional Operators in C#

In this article, we will discuss a feature of C# known as null-conditional operators and how it can help prevent the occurrence of null-reference exceptions, which are commonly encountered by developers. MAUI is a new technology and thus it's really fun to play around and develop with it. But what if...

How to Unit Test ILogger in ASP.NET Core

How to Unit Test ILogger in ASP.NET Core

We commonly write unit tests to test the business logic of our application. But what about the times we also want to make sure our logging works as expected? In this article, we will cover both cases and learn how to unit test ILogger in ASP.NET Core applications. ...

Vendor-Agnostic Telemetry Using OpenTelemetry Collector in .NET

Vendor-Agnostic Telemetry Using OpenTelemetry Collector in .NET

When building applications, we try to avoid being tightly coupled to any given third-party service/library, making it harder to switch this implementation with another in the future should the need arise. When working with OpenTelemetry in our applications, we can use...

How to Delete Elements from an Array in C#

How to Delete Elements from an Array in C#

In this article, we will explore several different ways to delete elements from an array in C# based on their value and compare their performance to help you choose the best option for your specific use case. An honest and insightful review of what Blazor brings us in .NET 8 by Damien...

The AddEndpointsApiExplorer Method in ASP.NET Core

The AddEndpointsApiExplorer Method in ASP.NET Core

In this article, we are going to learn about the AddEndpointsApiExplorer method in ASP.NET Core. We will learn why we need it and how we use it in our applications. For this article, we will use an ASP.NET Core Web API application with Swagger support. If you feel the...

Get Current User With Claims in ASP.NET Core

Get Current User With Claims in ASP.NET Core

In this article, we are going to see different ways to get the currently authenticated user using claims in ASP.NET Core. The code for this article is based on the respective code from the article on Authentication with ASP.NET Core Web API.  Async/Await and asynchronous programming are part of our lives for a...