How to Find the Caller Method in C#
In this article, we will learn how to find the caller method in C#. We will also learn about scenarios in which this information could be useful and how to retrieve it. [sc name="github"...
MY ARTICLES:
In this article, we will learn how to find the caller method in C#. We will also learn about scenarios in which this information could be useful and how to retrieve it. [sc name="github"...
In this article, we will take a look at testing if our code throws exceptions, why we want to do that, and how to do it in the MSTest, NUnit, and xUnit frameworks. [sc name="github"...
Creating robust applications and solutions that can stand the test of time requires using complex dates and timespans to ensure accuracy. C# offers a robust TimeSpan structure that allows developers to easily manipulate dates, durations, and ranges. In this article,...
In this article, we will learn and implement five different ways to return multiple values from a C# method. Returning multiple values to a...
In this article, we will learn how to read database connection strings from different configuration sources in .NET applications. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/aspnetcore-features/HowToReadConnectionStringsInDotNet"...
In this article, we will learn about IEnumerable, ICollection, IList, and List. We will also focus on how to choose the right one. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/collections-csharp/IEnumerableVsICollectionVsIListVsList"...
This article will look deeper into Enums in .NET and how we can improve them with the SmartEnum library. Let's begin! What Are Enums? Enumeration...
In this article, we will learn about situations where we may need to convert a file into a byte array. Additionally, we will learn two ways to perform the conversion in C#. If you want to learn how to convert a byte array to a file, check out our convert byte array to...
In this article, we are going to learn about passing output parameters to stored procedures with Dapper. Stored procedures are a great way to improve the performance, security, and usability of our code. They bring many advantages over relying on our application code...
In this article, we will learn when the "call is ambiguous" error happens, why the error happens, and how to work around the issue. There are still so many legacy projects using older versions of EF Core, and in those projects, this error can cause a lot of headaches...
In this article, we discuss how to create guard clauses, how they differ from user input validation, and how to improve our guards by writing clean guard clauses leveraging the GuardClauses library. [sc name="github"...
In this article, we will be learning how to compare two JSON objects in C#. Let's dive in. Data Preparation For this article, we will be using a...
In this article, we will look at the power of the File and FileInfo classes used for file manipulation in C#. We'll uncover the similarities and differences between these two classes and why we would want to use one over the other. [sc name="github"...
In this article, we’re going to learn how to change Swagger base uri in ASP.NET Core Web API. So let's start. Swagger and Base Uri Swagger is an...
In this article, we will discuss how to determine whether two date ranges overlap in C#. We will explore how to achieve this result using the DateOnly and TimeOnly records and then, we're going to beautify our implementation with a custom class representing date...
In this article, we will learn what multipart requests are and how we can use them. Also, we will review examples of how to send data to remote servers using multipart form-data with HttpClient in ASP.NET Core. [sc name="github"...
This article will examine how we can get a formatted JSON representation of our C# objects using two popular libraries - Json.NET and System.Text.Json. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/json-csharp/HowToGetFormattedJson"...
Introduction In this article, we'll look at ways to use dependency injection with constructor parameters in .NET Core. Dependency injection (DI) with constructor parameters is a way for us to pass the things our class needs (depends on) when we create a new instance...
In this article, we are going to present you solutions on how to return a default value from a Dictionary in C# and run an evaluation test against these methods to find the most efficient. [sc name="github"...
In this article, we are going to learn about the various patterns to implement asynchronous programming in .NET. .NET has had in-built support for asynchronous programming since the release of .NET Framework 1.1. It has been through various improvements over the...