Code Maze Weekly #172
Issue #172 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Avoid Proliferating DbContext or IQueryable in .NET Apps [ardalis.com] How much should we use DbContext or IQueryable throughout...
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. Sometimes getting a piece of information from a...
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. 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...
How to Get the Remote Host IP Address in ASP.NET Core Web API
In this article, we will learn what is a remote host IP address and explore different ways to extract it in ASP.NET Core Web API. Let's start....
Code Maze Weekly #170
Issue #170 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks 13 Libraries in ASP.NET Core Every Developer Should Know About [codingsonata.com] Some of the extremely helpful libraries we...
How to Store JSON in an Entity Field With EF Core
In this article, we are going to talk about how to store data in the JSON entity field using Entity Framework Core. But before we start, we...
Extending LINQ to Objects With MoreLINQ Library
In this article, we'll explore the capabilities of the MoreLINQ library, which enables us to improve the already robust LINQ functionality. Let's...
Fast Inserts With Entity Framework (EF Core)
In this article, we will review multiple ways of performing fast inserts of bulk data into a database using the Entity Framework (EF for short). Entity Framework "classic" was introduced in 2008, was superseded nearly a decade later by EF Core, and continues to add...
How to Run an Async Method Synchronously in .NET
In this article, we will learn how to run an async method synchronously in .NET. Let's start. Different Ways We Can Run Asynchronous...
Easy Sorting, Filtering and Pagination in .NET With Sieve Package
Most applications that are developed nowadays usually involve interacting with non-trivial amounts of data, so we need to provide functionality for sorting and filtering in our applications. Moreover, speed and load times are increasingly important, so we don't want...
How to Return XML From ASP.NET Core Web API
ASP.NET Core is a powerful and flexible platform for building web applications. It supports multiple data formats, including JSON and XML, and provides many tools for serialization and deserialization. In this article, we will focus on how to return XML from ASP.NET...
Static Methods vs. Non-Static Methods in C#
In this article, we are going to look at the difference between static and non-static methods in C#. In truth, there are many .NET languages...
Short Circuit Evaluation of IF Statements with Await in C#
In this article, we are going to look at what exactly short circuit evaluation is in C# and how asynchronous calls are affecting it. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/async-csharp/ShortCircuitEvaluationWithAsyncAwait"...
How to Serialize Exceptions as JSON in .NET
In this article, we will learn how to serialize exceptions as JSON in .NET. Good exception handling is one of the key aspects of a successful enterprise application. And when we talk about an API, it's important that we provide relevant failure details to consumer...