Cancellation Tokens with IAsyncEnumerable
This article will remind us what cancellation tokens are and how to use them in C#. After that, we are going to talk about how we can use them with the IAsyncEnumerable interface and the cases when we should be careful while using them. To download...
Code Maze Weekly #104
Issue #104 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Modernize WinForms and WPF apps with BlazorWebView [danielhindrikes.se] With BlazorWebView you can host Blazor inside of your native app, in the same process as the rest...
Difference Between “throw” vs “throw ex” in C#
In this article, we are going to discuss a subtle, but hugely important subject - the difference between throw and throw ex. Understanding this simple distinction might save a significant amount of debugging time and stress. To download the source...
Code Maze Weekly #103
Issue #103 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# A .NET 5.0 Guide: From Idea To NuGet Package [khalidabuhakmeh.com] A step-by-step guide to getting your code published to NuGet by Khalid Abuhakmeh. What’s New in C# 10:...
Dependency Injection Lifetimes in ASP.NET Core
While registering our services in the ASP.NET Core DI container, we can configure them with different lifetimes. In this article, we are going to talk about the different dependency injection lifetimes. To download the source code for this...
Code Maze Weekly #102
Issue #102 of the Code Maze weekly. Check out what's new this week and enjoy the read. Next week we'll be starting BLACK FRIDAY offers a bit earlier. If you've planned to get some of our materials, this will be the best offer the...
Using Multiple Databases in ASP.NET Core via Entity Framework Core
In this article, we are going to learn how to add multiple databases in the ASP.NET Core project using Entity Framework Core. We are going to show you how our repository pattern implementation helps us in the process by using abstractions that will hide all the...
Code Maze Weekly #101
Issue #101 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Bite-Size .NET 6 - UnionBy, IntersectBy, ExceptBy, and DistinctBy [exceptionnotfound.net] .NET 6 includes a new set of methods in the LINQ library to help us work with...
C# Delegates
In this article, we're going to talk about C# delegates, which are a prerequisite for learning events-based programming. Delegates are one of the fundamental building blocks of flexible applications, as they can be found in the vast majority of .NET framework code...
Code Maze Weekly #100
Issue #100 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# A quick review of C# 10 new language features [thomaslevesque.com] An excellent way to prepare for the release of .NET 6 and C# 10 that's around the corner. Let's go...
.NET Collections – IEnumerable, IQueryable, ICollection
In this article, we are going to discuss three popular interfaces in the area of .NET collections. We all use collections every day in .NET, but do we really understand the difference between each of them, and when we should use one or another? Hopefully, at the end...
Code Maze Weekly #99
Issue #99 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# The Hot Reload Debacle [dotnetcoretutorials.com] There has been some drama regarding the hot reload functionality and dotnet watch this week. We think it's important to...
Google Sheets API with .NET Core
In this article, we’re going to explore the Google Sheets API using the Google Sheets Client Library for .NET. We’ll start with configuring the Google Sheets API in the Google developer console. Then we'll build an ASP.NET Core application that can read and write data...
Code Maze Weekly #98
Issue #98 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Bulk Import Records Into SQLite With C# [khalidabuhakmeh.com] Seeding SQLite with EF Core can be useful in many scenarios in real life like quick demos and presentations....
IAsyncEnumerable with yield in C#
The support for Async Streams was one of the most exciting features that came out with .NET Core 3.0 and C# 8. This is possible with the use of IAsyncEnumerable with the yield operator. In this article, we are going to explore how to take advantage of this new feature...
Code Maze Weekly #97
Issue #97 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Add new endpoint to ASP.NET Core application Runtime using API Framework [mikaelkoskinen.net] Interesting read by Mikael Koskinen on how to add new endpoints to the...
CQRS Validation Pipeline with MediatR and FluentValidation
In this article, we are going to show you how to elegantly integrate a validation pipeline into our project using the MediatR and FluentValidation libraries. As .NET 6 is around the corner (November) this is a great opportunity to explore some of the new...
Code Coverage in .NET
In this article, we are going to explore the topic of code coverage in .NET and look at what tools we can use to understand and improve code coverage in the software we build. To download the source code for this article, you can visit our Code...
Code Maze Weekly #95
Issue #95 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Grouping Assertions in Tests [ardalis.com] Sometimes we need to assert multiple things in a single test because it makes sense. This goes against best practices in unit...
Events in C#
Events in C# are a mechanism that classes use to send notifications or messages to other classes. They are a specialized delegate type that we use to notify other classes when something they listen to happens. Events are a vital part of many applications, and a...