Should We Use Records With EF Core as Model Classes?
In this article, we will explore the pros and cons of using records with EF Core as model classes. We'll dive into what C# records are, how they differ from classes, and how they can be used as model classes in EF Core. [sc name="github"...
How To Set Up SSL Certificate In Visual Studio and .NET CLI
In this article, we'll look at setting up an SSL certificate for use in ASP.NET web applications and creating a new SSL certificate using Visual Studio and the .NET CLI. We'll also look at how to remove SSL certificates using the Windows certificate manager and the...
Expression Trees in C#
In this article, we will talk about Expression Trees in C#, how to use them, and see some of their applications. We'll also learn about their limitations and performance consideration. Although the topic may initially sound complex, itβs much simpler when we know a...
Refactoring Change Preventers in C#
In this article, we are going to discover which anti-patterns fall into the class of code smells known as change preventers, as well as several approaches for refactoring them in C#. [sc name="github"...
How to Pass Parameters With a GET Request in ASP.NET Core
In this article, we'll discuss the different ways to pass parameters to a GET request in ASP.NET Core. Before we dive into this...
Code Maze Weekly #175
Issue #175 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks 5 Differences between Blazor Server and Blazor WebAssembly [www.claudiobernasconi.ch] Blazor Server and Blazor WebAssembly often...
How to Build Dynamic Queries With Expression Trees in C#
Applications are becoming more complex and data-driven over time. Indeed, developing the ability to create and modify dynamic queries at runtime is becoming a critical skill for developers. In this article, we'll explore the basics of building dynamic query expression...
How to Send Emails With the SendGrid API in C#
In this article, we will take a look at how to send emails with the SendGrid API directly from our code. Sending emails from within our applications is a common scenario that we face as developers. Let's look at a couple of use cases where we may need to do this. [sc...
Memory Allocation Optimization With BenchmarkDotNet
In this article, we will focus on memory allocation optimization using BenchmarkDotNet. We will also learn how to effectively do that using the MemoryDiagnoser attribute while comparing two of the most popular sorting algorithms - QuickSort and MergeSort. [sc...
Content Security Policy in ASP.NET Core
In this article, we are going to discuss the use of a Content Security Policy (commonly referred to as "CSP"). While we can apply a CSP to...
Deploy ASP.NET Core on Linux with Nginx
In this article, we are going to learn how to deploy an ASP.NET Core web application to the Ubuntu Linux server with Nginx. The introduction of .NET Core opened the cross-platform doors, allowing developers to build and deploy applications on Linux systems. At the...
How to Convert a String to a Span in C#
In modern C# programming, we all strive for efficiency and top-notch performance. And when it comes to dealing with character data, converting a string to a span can be a game-changer. So, in this article, we'll dive into the process of converting a string to a span...
How to Use SFTP For Secure File Upload in .NET
In this article, we will learn what Secure File Transfer Protocol is and how to use SFTP file upload to securely send files to a remote server in .NET and C#. [sc name="github"...
Code Maze Weekly #174
Issue #174 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks The Ultimate .NET Version Guide [www.claudiobernasconi.ch] .NET versions can be confusing, especially if you're new to .NET. Take...
How to Map DateOnly and TimeOnly Types to SQL
In this post, we are going to learn how to map DateOnly and TimeOnly types to SQL with migration. Let's dive in. DateOnly and TimeOnly Types...
Using System.Text.Json for Camel Case Serialization
In this article, we'll learn how to use System.Text.Json for camel case serialization in .NET 7. First, we'll take a glance at the default behavior when serializing. Then we'll use two different ways for the camel case serialization. Lastly, we'll discuss how we can...
How to Generate Permutations in C#
In this article, we will examine the world of algorithms. Specifically, we will talk about an algorithm that we can use to generate permutations. ...
Swashbuckle vs. NSwag in ASP.NET Core
In this article, we will explore the two popular libraries for generating OpenAPI documentation in C#: Swashbuckle and NSwag. We'll compare their features, ease of use, and other factors that will help us choose the best one for our projects. [sc name="github"...
Different Ways to Initialize a String in C#
In this article, we will discuss how we can initialize a string in C# and the recommended best practices to follow. We will explore different approaches and techniques that enable us to achieve proper initialization and efficient utilization of strings.Β [sc...
How to Convert Stream to Byte Array in C#
In this article, we are going to learn how to convert a stream to a byte array in C#. A Stream represents a continuous...
Object Initializers in C#
In this article, we are going to learn about object initializers in C#, which is a feature introduced in version 3.0 that simplifies code by eliminating the need to write multiple lines of code to initialize an object and its properties. [sc name="github"...