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"...
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"...
Structured Logging in ASP.NET Core With log4net
Log4net is a very popular open-source logging library for .NET applications. This library is part of the Apache Logging Services project at the Apache Software Foundation. Log4net provides a flexible way of writing logs to different output targets like files,...
How to Reverse a String in C#
Reversing a string is a common task in programming, and C# provides several ways to accomplish it. Whether we need to reverse a string for sorting purposes, to improve search efficiency, or for any other reason, understanding how to perform this operation in C# is an...
Compare DateTime in C#
In C#, several methods and operators are available to compare DateTime. In this article, we will learn about them along with the best practices. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/dotnet-datetime/CompareDateTimeInCSharp"...
ML.NET – Introduction to Machine Learning With C#
In this article, we will provide an overview of machine learning and explain how ML.NET enables it. We will learn how to build, train, and optimize a simple machine-learning model. Finally, we will see how the model can be used in a real-life application. [sc...
URI Encode and Decode in .NET
In this article, we are going to learn about URI encode and decode and how we can achieve this using .NET. So, let's start. What is URI...
Init Only Setters in C#
In this article, we'll dive into one of the cool new features of C# 9.0: the Init keyword. First, we'll take a closer look at what this feature is. Then, we'll explore how the Init keyword works and how we can incorporate it into our projects. [sc name="github"...
Multidimensional Array vs Jagged Array in C#
There seems to be a fair amount of confusion about the two ways to model a multidimensional array in C#. We will explore differences and similarities and hopefully help you choose the best model for your project. If you need to brush up on array basics you can check...
Unit Testing With UserManager and RoleManager in ASP.NET Core Identity
In this article, we will learn how to perform Unit Testing with UserManager and RoleManager in ASP.NET Core Identity. Unit testing is an essential practice in software development that helps ensure the correctness and reliability of code. In the context of ASP.NET...
Secure Microservices Using JWT With Ocelot in .NET Core
Microservices are a common design pattern nowadays in software applications. Moreover, we usually have some sort of API Gateway, such as Ocelot, to provide a single API for consumers of our microservices and encapsulate underlying implementation details and handle...
ArrayList and List Comparasion in C#
While building an application, we often encounter situations to store or retrieve objects and .NET gives plenty of storage options to do that. These options are categorized into generic and non-generic collection types. In this article, we are going to see two such...
How to Identify If a String is a Number in C#
In this article, we are going to learn some different ways to identify if a string is a number in C# and compare them with a benchmark to determine the fastest and the slowest approach. [sc name="github"...
Uploading Large Files in ASP.NET Core
In this article, we are going to learn how to handle uploading large files in ASP.NET Core. We are going to talk about why using byte[] or MemoryStream can be problematic and discuss the benefits of using streams instead. By leveraging streams, we can significantly...
Using sizeof() Operator in C#
If we are looking for a way to get the size of a data type in C#, mastering the sizeof() operator is just what we need. This operator returns the accurate memory size that any data type occupies. In this article, we will dive into understanding how to use this...




