Latest Posts On Code Maze

Execute JavaScript Using Selenium WebDriver in C#

Execute JavaScript Using Selenium WebDriver in C#

As developers, we always look for ways to make our work easier so we can focus on more exciting projects or learn new things. A big part of this is finding ways to quickly test our work, like new features or bug fixes, to ensure everything runs smoothly. This is where...

Introduction to Autofac FakeItEasy Package

Introduction to Autofac FakeItEasy Package

In this article, we'll learn about the Autofac FakeItEasy Package, its features, benefits, and how to get started. We'll learn how to use the package to create unit tests for our applications. [sc name="github"...

Querying MongoDB With ObjectId in C#

Querying MongoDB With ObjectId in C#

In this article, we will look at how to retrieve MongoDB documents using ObjectId in C#. We will only cover how to query a MongoDB database using ObjectId in C#. Check out our article Getting Started with ASP.NET Core and MongoDB for more information on how to set up...

dotnet build and dotnet run: Using the .NET CLI

dotnet build and dotnet run: Using the .NET CLI

The .NET CLI is the dotnet command, and seven of its subcommands do almost everything: new creates, build compiles, run compiles and starts, watch reruns on save, publish packages for a server, test runs tests, and add edits the project file. dotnet build is the one...

File Access Modifier in C#

File Access Modifier in C#

In this article, we will learn about the File Access Modifier in C#. We will focus on what problems it solves and how to use it.  ...

How to Decode a JWT Bearer Token in .NET

How to Decode a JWT Bearer Token in .NET

To decode a JWT in .NET, we pass the token string to JsonWebTokenHandler.ReadJsonWebToken() from the Microsoft.IdentityModel.JsonWebTokens package and read the header and claims from the JsonWebToken it returns. Decoding checks nothing, so we trust none of what we...

Tuple Aliases in C#

Tuple Aliases in C#

In this article, we will take an in-depth look at tuple aliases: what they are, how to use them, and the different rules that apply to them.  [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/csharp-intermediate-topics/TupleAliasInCSharp"...

Spectre.Console: Build Better-Looking C# Console Apps

Spectre.Console: Build Better-Looking C# Console Apps

Spectre.Console is a NuGet library that turns a plain, monochrome .NET console app into one with colored markup, tables, calendars, bar charts, progress bars, FIGlet banners and interactive prompts. We build each of these on one small list of students. After that, we...

Blazor WebAssembly Ahead of Time Compilation

Blazor WebAssembly Ahead of Time Compilation

In this article, we will explore the concept of ahead-of-time (AOT) compilation in Blazor WebAssembly projects. We'll explain how to enable AOT compilation, how it operates, and when it proves effective. Additionally, we'll look at how it optimizes applications with...

Hexagonal Architecture in C#: Ports and Adapters in .NET

Hexagonal Architecture in C#: Ports and Adapters in .NET

Hexagonal architecture, also known as the ports and adapters pattern, keeps the application core independent of external components, such as storage, UI, and communication protocols. We will explain its structure, where it came from, and its advantages and...

How to Rename Files and Folders in C#

How to Rename Files and Folders in C#

.NET has no File.Rename() method. To rename a file in C#, we move it to a new name in the same folder with File.Move() or FileInfo.MoveTo(), and to rename a folder we call Directory.Move(). We'll find the files first, rename one, then a whole batch, then a folder, and...

How to Switch Between .NET SDK Versions

How to Switch Between .NET SDK Versions

In this article, we will learn how to switch between .NET SDK versions in our projects. By default, .NET uses the latest SDK installed on a given machine, even when developing with an earlier .NET runtime version. Actually, we can benefit from the latest SDK features...

Local Functions in C#

Local Functions in C#

In this article, we will learn about the local functions in C#. We'll explore the significance of local functions and how we can create them. Furthermore, we will discuss the best practices and compare them with lambda expressions. [sc name="github"...

How To Read the Request Body in ASP.NET Core Web API

How To Read the Request Body in ASP.NET Core Web API

The request body arrives as a forward-only stream, and whoever reads it first is usually the only one who gets it. That single fact decides everything about reading the request body in an ASP.NET Core Web API: where we can read it, whether model binding still works...

How to Determine the Operating System in .NET Core

How to Determine the Operating System in .NET Core

In this article, we are going to find out how to determine the operating system of a computer on which our .NET Core application is running. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/dotnet-base-libraries/DetermineOperatingSystem"...