In a previous post in which we discussed about the Null Object Pattern, we discussed of a hackish approach to make sure that the default properties cannot be changed. Please note that the code snippets from this post have been run in LinqPad so they can be used as is, to run them in Visual … Continue reading The C# 9 init-only setters
InDepth
Typed claims in ASP.Net Core 2.1
Hello and Welcome 🙂 Today I want to discuss about how we can use claims following a typed approach, this topic came about from a bug that was encountered during a code review for an application. As such I wanted to find a way of mitigating such issues in the future by using concrete classes … Continue reading Typed claims in ASP.Net Core 2.1
Enhancing Asp.Net Core logging pipeline with Serilog
Enhancing Asp.Net Core logging pipeline with Serilog Hello and welcome :), Today I want to show how we can switch out the default logging pipeline in favor of Serilog which has a lot more providers implemented by the community and also provides a way to log structured data. The backstory For those of you who … Continue reading Enhancing Asp.Net Core logging pipeline with Serilog
Getting Closure on Closures
Hello and welcome, It’s been some time since last I wrote, and the reason behind this is because I got caught up in learning more about other languages, particularly Lua, javascript and python, and in this adventure I encountered a repeating topic that I thought is also present in .Net yet not often enough discussed, … Continue reading Getting Closure on Closures
Rolling our own IoC
Hello and welcome 🙂 Previously we talked about what Dependency Inversion and Dependency Injection are, today we’re going to look at what an Inversion of Control (IoC) container is and how it works. In the future, we will also have a look at what are the common implementations of IoCs available and which are my … Continue reading Rolling our own IoC
Games as a service?
Hello and welcome, Today I will try something different, both as a way of writing the posts and also today’s post is not so much about what we do during this post as to what we learn from it and opening up new ways of thinking. New Tool First off, I want to mention that … Continue reading Games as a service?
Performance with IDisposable, outside the box
Hello and welcome, Today I wanted to share with you a technique I used in the past, though by all means not an impressive feat. But first a little story about IDisposable and why I chose this approach. The IDisposable interface is mainly used as a way for the Gargabe Collection to release unmanaged resources, … Continue reading Performance with IDisposable, outside the box
Enums, Flags and Binary Literals
Hello and welcome, Today we're going to look at the enum value types, how they can be composed as flags and how C# 7 makes it easier for us to use and understand. We touched upon enums during the post The hidden side-effect of enums and values. Now we're going to have a more in-depth … Continue reading Enums, Flags and Binary Literals
IEnumerable and state machines
Hello and welcome, In a previous post, we had a look at enumerators and how .NET works with the foreach loop, we saw how enumerators are actually objects that transition from one state to another by using the MoveNext method and the Current property. We know that if we want to make a custom enumerator … Continue reading IEnumerable and state machines
The hidden side-effect of enums and values
Hello and welcome, Recently I encountered an issue with enums, which I wanted to share in case someone else encounters it along the way. So what are enums? Enums are a list of numerical constants that help us in a number of situations, like for example when something can have a tag or a property … Continue reading The hidden side-effect of enums and values