Blazor – first impressions

What is Blazor? To quote the official Blazor homepage ”Blazor is a single-page web app framework built on .NET that runs in the browser with WebAssembly.” The natural follow-up question is then ”What is WebAssembly?”. From the official WebAssembly homepage we can read that ”WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based […]

How to design a REST API with C# in ASP.NET Core 2

What is REST? REST is short for Representational State Transfer,  and is way to design web services. So called RESTful web services. Usually the RESTful service is accessible via a URI and HTTP operations such as  GET, POST, PUT, and DELETE are used to get or modify the data that is often stored in a […]

How to design a Priority Queue in C#

What is a Priority Queue? To be a bit formal, a priority queue is an abstract data type (ADT), similar to a regular queue, but where each element has a priority associated to it. An element with high priority is served before an element with a low priority. Elements which have the same priority are […]

Book Review – The imposter’s handbook

Introduction Just by reading the heading of this blog post won’t tell you anything about what kind of book I am writing a review on. The full title is actually The imposter’s Handbook – A CS Primer For Self-Taught Programmers, where CS is short for Computer Science. The book is written by Rob Conery, a […]

C# struct and class – when to use each?

Value types and Reference types In C# you have both Value types and Reference types. There are some fundamental differences between them that are important to understand. The most common value types are the simple ones, like int, bool, char, and long. But also enum and struct are value types. They are called value types […]

C# Protecting private collections from modification – Part 2

The common object issue In the last part I wrote about how you can protect a class’s private collections from modification by wrapping them in a ReadOnlyCollection before exposing them. But how about collections that are handed to your class? Consider the following code: What happens here is that MyClass takes a variable of reference […]

C# Protecting private collections from modification

Why do we want to hide data? One of the big advantages of object oriented programming is claimed to be possibilities to encapsulate data and hide internal implementation details. This enables us to make changes to our implementation without impacting our users and ensures our internal data does not get modified in ways that we […]