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#,...
Code Maze Weekly #208
Issue #208 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Responsive Images Crash Course for ASP.NET Core Developers [khalidabuhakmeh.com] Here's something a bit different but important if you're into web development....
Present a List of Files in a Directory With Directory Browsing in ASP.NET Core
In ASP.NET Core, directory browsing is a feature that allows a web application to present a list of files in a specified directory to the user. For security, however, directory browsing is disabled by default to prevent unauthorized users from accessing a website's...
Improve Performance With Source-Generated RegEx in .NET
In this article, we'll look at source-generated RegEx and how it can improve performance in our .NET applications. ...
Scale Your Services With Service-Oriented Architecture in .NET
In this article, we will discuss the Service-Oriented Architecture in .NET. We will cover what it is, how to implement it, how it differs from Microservice Architecture, and how we can use cloud computing platforms as a jump pad to quickly stand up services and...
How to Validate a GUID in C#
In this article, we will explore several approaches to validate a string representation of a GUID in C#. So let's dive in. What Does...
Generate Sortable Unique IDs With the NewId Library in .NET
In this article, we'll explore why we might need sortable unique IDs in .NET and how to create them with the NewId NuGet Package. ...
Different Ways to Create a Generic List of Anonymous Types in C#
Knowing how to manipulate complex datatypes such as Lists is crucial when storing and manipulating data in C#. Sometimes, we may want to incorporate versatility by not having to define explicit classes and create generic lists of anonymous types in C#. In this...
The Fastest Way to Remove the Last Character of a String
Creating and manipulating string objects can be useful when building applications. In the C# programming language, string objects contain text values stored as a sequential read-only collection of character objects. This means string objects are immutable and thus...
Code Maze Weekly #207
Issue #207 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks C# 12: Alias Any Type [www.thomasclaudiushuber.com] Aliasing types and namespaces has been around for the longest time. With C# that feature has been extended...
Fastest Way to Check if a List is in Order in C#
In this article, we'll examine different techniques to check whether or not a list is in order in C#. We'll begin by examining several techniques, including parallel processing. Finally, we'll run a series of benchmarks to help us choose which option fits best in our...
How to Get the HTML Content of a Web Page as a String in .NET
In this article, we will look into a comprehensive guide on how to get the HTML content of a web page as a string and how to parse the content retrieved. First things first, we'll learn how to retrieve HTML content as a string from the web using tools like HttpClient,...
How to Use Entity Framework Core Migrations in Production
In this article, we will discuss the different approaches to migrating a production database when using Entity Framework (EF) Core code-first migrations. types. We aim to understand how to convert ReadOnlyMemory to a byte array, specifically using the MemoryMarshal.AsBytes() method. We also explore scenarios where this...
Code Maze Weekly #206
Issue #206 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks C# 12: Collection Expressions [www.thomasclaudiushuber.com] C# 12 has introduced a new and simpler way to initialize collections. If you want to stay...
How to Benchmark a Method’s Performance Across Different .NET Versions
As .NET developers, we often benchmark the performance of our methods using a single .NET version. However, we can also benchmark a method's performance across different .NET versions. Such benchmarks can come in handy when we want to upgrade our codebase to a newer...
How to Convert IAsyncEnumerable to List
In this article, we will learn how to convert IAsyncEnumerable to a List in C#. We'll talk about some practical reasons for this conversion and explore the common method for achieving it. [sc name="github"...