Kristoffer Strube

Kristoffer Strube

Denmark
23 posts
New LINQ extensions in .NET 6 and benchmarks

LINQ has also gotten some attention during the development of .NET 6. Multiple new extensions have been added. Among these additions are: Support for indices and ranges when using IEnumerable collections, adding key selector variants for many of the existing LINQ extensions so that you can use e.g. MaxBy ...

Using the new PriorityQueue from .NET 6

.NET 6 has brought along a lot of new features. Among these is a new collection type: the PriorityQueue. A PriorityQueue contains pairs of elements and priorities. It then keeps track of the min value of the priorities. This is useful if you need to keep track of a min ...

Rendering dynamic content in Blazor Wasm using DynamicComponent

Sometimes we need to load different types of components dynamically. This is especially needed in scenarios where we cannot define a general structure e.g. in a blog with different types of content intermixed. Previously, we needed a big switch statement to check for different types and explicitly write out ...

Blazor WASM 404 error and fix for GitHub Pages

The project structure of a Blazor WASM project is in some places very different than other frontend frameworks in the .NET stack. One of the nice things about Blazor WASM is that it can be hosted by any static file host. A problem with this is that routing is handled ...

Easy generation of fake/dummy data in C# with Faker.Net 🕵️

When developing, testing, or showcasing something it's often important to use data that is not real data. Either because you might not have actual data available yet or because you don't want to show or pick the data from real users which can contain sensitive information. Faker.Net can help ...

Generate iCal calendar with .NET using iCAL.NET 📅

Calendars are a great part of many people's every-day-life. Integrations with calendars can be a great way to interact very directly with your users and is often a very sought after feature if you have some kind of events as part of your platform. In this article, we will show ...

Using JS Object References in Blazor WASM to wrap JS libraries

Among the .NET 5 Blazor improvements there are IJSObjectReference's (JavaScript Object References). The name indicates that this can only be used to isolate JavaScript sources similar to CSS Isolation. But IJSObjectReference can do so much more than just isolation. ...

How to fix Blazor WASM base path problems

A lot of people were intrigued when we got to know that Blazor WASM would come with features like client-side routing. But Blazor WASM applications are still Single Page Applications (SPAs) at their core. This means that they have the same restrictions as any other SPA framework. In this post, ...

How to add User-Agent header to HttpClient in .NET

An intrinsic part of the modern web application is the ability to use external APIs and webpages. In .NET this is done using the HttpClient class. The HttpClient class does not add the field User-Agent out of the box. According to the HTTP standard, it is recommended that this is ...