Latest Posts On Code Maze

Baseline Styling in BenchmarkDotNet

Baseline Styling in BenchmarkDotNet

In this article, we will learn how to set a baseline for our benchmark in BenchmarkDotNet and discuss styling the baseline results. As software developers, benchmarking the performance of our methods is a crucial part of our day-to-day activities. With the...

Introduction to Strawberry Shake and GraphQL in .NET

Introduction to Strawberry Shake and GraphQL in .NET

In this article, we'll get familiar with GraphQL and Strawberry Shake, a GraphQL tool that facilitates interaction with local and remote data. Subsequently, we will build an application using the .NET API, focusing on customers searching for available space in...

Fastest Way to Find and Extract a Number From a String in C#

Fastest Way to Find and Extract a Number From a String in C#

This article will explore the quickest method to find and extract a number from a string in C#. We will discuss and implement different techniques for accomplishing this task. Subsequently, we will evaluate the performance of these techniques using the BenchmarkDotNet...

How to Detect if a Key is Pressed in a C# Console Application

How to Detect if a Key is Pressed in a C# Console Application

We frequently read data from user input in our C# application. However, we sometimes need to detect a key press and continue the operation. In this article, we discuss how to detect if a key is pressed in a C# console application. By understanding the usage of these...

How to Test gRPC Services in ASP.NET Core

How to Test gRPC Services in ASP.NET Core

gRPC is a popular way to create fast and scalable API's in the .NET world. In this article, we explore how to test gRPC Services in .NET applications, and set up both unit and integration tests to ensure the reliability and performance of gRPC services. [sc...

Restricting a Value Lifetime With the “scoped” Keyword in C#

Restricting a Value Lifetime With the “scoped” Keyword in C#

In this article, we will discuss the scoped keyword in C#, explore its use case, and examine how it can be advantageous. The contextual keyword scoped in C# serves as a powerful tool for restricting the lifetime of a value. Employing the scoped modifier allows us to...

How to Validate File Upload Extensions in ASP.NET Core

How to Validate File Upload Extensions in ASP.NET Core

In this article, we will see how we can validate file upload extensions and be certain that our applications are safe from malicious uploads. When receiving files uploaded by users, relying solely on file names to determine file types is risky. This is because we can...

How to Retrieve the Number of CPU Cores in C#

How to Retrieve the Number of CPU Cores in C#

In the realm of C# programming, understanding the underlying hardware can be crucial for optimizing performance. One fundamental aspect is knowing the number of CPU cores available. In this article, we will explore methods to retrieve the number of CPU cores in C#,...