Code Maze Author

Code Maze

This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.
Also find me here:



MY ARTICLES:

Hot Reload in ASP.NET Core Applications

In this article, we will dive into what hot reload is and how it revolutionizes our development workflow. We will review its features, origins, examples, and most importantly best practices. Let's start. What is Hot Reload Hot reload stands as a transformative feature...

How to Force Run .NET Application as Administrator

In this article, we will learn how to force run a .NET application as an Administrator. We will do that by modifying the application manifest file of our application to illustrate the whole process. [sc name="github"...

Handling Dates With Noda Time in .NET

Handling dates can be confusing, especially when developing an application with time-sensitive data and users across different time zones. That's where Noda Time comes in. In this article, we will learn about handling dates using Noda Time in .NET and streamline our...

How to Build a Query String for a URL in C#?

A query string is the ?name=value&name=value tail of a URL, and in C# we have six ways to build one. Four of them percent-encode the values for us. UriBuilder, the one most people reach for, does not. QueryHelpers.AddQueryString() is the short answer for an...

Strangler Fig Architectural Pattern in C#

In this article, we will discuss the use of the strangler fig architectural pattern. While the design can be applied to any programming language, we will focus on C# here.  [sc name="github"...

How to Read a String From a .resx (Resource) File in C#

In this article, we are going to learn how to read a string from a .resx file. While doing this, we are also going to understand what is going on under the hood. Additionally, we will follow some of the best practices on how to manage resource files, and lastly, offer...

Dynamically Adding Rows on a Form in Razor Pages

In this article, we will delve into ASP.NET Core forms and how to add rows to them dynamically. We'll use razor pages to create the form and SQLite as our database. [sc name="github"...

AutoMapper: How to Ignore Null Values When Mapping

To stop AutoMapper overwriting a destination value with a null from the source, add a condition to the mapping: .ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null)). Members whose source value is null are then skipped, and whatever...

Understanding the Unit of Work Pattern in C#

In this article, we will discover the unit of work pattern, its advantages and disadvantages, and an example implementation that is completely ORM agnostic. Moreover, we will look at the unit of work's connection with the repository pattern and we will see how easy it...

C# String Contains Ignore Case: Substring Search

To find a substring while ignoring case in C#, pass a StringComparison value: source.Contains(needle, StringComparison.OrdinalIgnoreCase). Without that second argument, Contains() is case-sensitive, and there is no other switch that changes it. [sc name="github"...

Replace Line Breaks in a String in C#: ReplaceLineEndings

A line break in C# is not one character. It is any of seven sequences, and ReplaceLineEndings() is the one method that matches all of them: text.ReplaceLineEndings("\n") normalises a mixed string in a single call. String.Replace() and Regex.Replace() also do the job,...

Refactoring Dispensables in C#

In this article, we will explore refactoring dispensables in C#. We'll focus on identifying code smells and enhancing our code through practical refactoring techniques. [sc name="github"...

C# XPath: Select XML Nodes With SelectSingleNode

XPath is a path language for XML, and .NET exposes it through two methods on XmlNode: SelectSingleNode() returns the first node an expression matches, and SelectNodes() returns every one of them. An expression reads like a file path. /catalog/book walks down from the...