Latest Posts On Code Maze

Introduction to the StronglyTypedId Package in .NET

Introduction to the StronglyTypedId Package in .NET

In this article, we'll look at the StronglyTypedId NuGet package and how it helps us enhance type safety and code readability in our .NET projects by generating strongly-typed IDs for our entities. [sc name="github"...

How to Compare Two Files in C#

How to Compare Two Files in C#

In this article, we will learn how to compare two files in C#. There are several reasons why we might want to compare two files in our code, such as integrity checks, detecting duplicate files, version control, synchronization, and more. But what are the different...

How to Set Global Default JSON Serialization Options in .NET

How to Set Global Default JSON Serialization Options in .NET

JSON serialization is the process of transforming .NET objects into JSON format, which ensures data exchange within applications. Implementing global default JSON serialization settings in ASP.NET Core Web API maintains uniformity across applications. In this article,...

How to Filter a List Based on Another List In C#

How to Filter a List Based on Another List In C#

Lists in C# are one of the most ubiquitous data structures. We perform all kinds of operations on them, such as appending, inserting, removing, sorting, and filtering. In this article, we'll focus on the latter - filtering. In particular, we'll see how to use a list...

View-Based Authorization in ASP.NET Core

View-Based Authorization in ASP.NET Core

View-based authorization is an authorization strategy that enables us to manage UI elements' visibility based on the user's identity. In this article, we'll take a look at how we can achieve view-based authorization in an ASP.NET core application. [sc name="github"...

Add a Cookie to an HttpClient Request/Response in ASP.NET Core

Add a Cookie to an HttpClient Request/Response in ASP.NET Core

What are cookies? Websites send small pieces of text, known as internet cookies, to our browsers whenever we visit them. They help us have a personalized experience on that particular website and remember it for the next time we visit it. Our goal today is how to make...

How to Generate a Random Color Name in C#

How to Generate a Random Color Name in C#

In this article, we will learn how to generate a random color name using the KnownColor enumeration. This enum is particularly useful in UI design and data visualization, as it provides a wide variety of preset colors. [sc name="github"...

How to Find the Latitude and Longitude of a Location in C#

How to Find the Latitude and Longitude of a Location in C#

In this article, we will learn how to find the latitude and longitude of a location in C# using the Google Maps Geocoding API. We'll introduce two different methods for obtaining the coordinates: using the GoogleMaps.LocationServices NuGet package, which simplifies...

Generate QR Codes With QRCoder in .NET

Generate QR Codes With QRCoder in .NET

In this article, we will discuss how to generate QR codes, specifically with the .NET library QRCoder. We will generate basic QR codes that contain simple strings, discuss reading from and writing QR codes to a database, and try out real-life use cases, such as...

How to Update an Item in a List in C#

How to Update an Item in a List in C#

In this article, we'll look at how to update an item in a List in C#, using a simple library management system as an example. We'll explore the intricacies of this common operation and learn how to manipulate lists in our C# applications effectively. [sc name="github"...

Differences Between .NET and C#

Differences Between .NET and C#

When diving into the programming world, distinguishing between .NET and C# can be puzzling. .NET is a framework, that provides a platform for building applications. In contrast, C# is a programming language used within this framework. Despite their close association,...

Serialization and Deserialization with YamlDotNet

Serialization and Deserialization with YamlDotNet

YAML (YAML Ain't Markup Language) is a human-readable data serialization language, while YamlDotNet is a .NET library that helps us serialize and deserialize YAML data. Due to its simple and intuitive syntax, programming languages frequently use YAML for configuration...

Fastest Way to Get a Dictionary Key by Value in C#

Fastest Way to Get a Dictionary Key by Value in C#

The C# language does not provide a built-in method that we can use to retrieve a key from our dictionary using its value. However, using other features of the language, we can create methods to perform this task. In this article, let's implement and discuss several...