Parallel.ForEachAsync Deep Dive
This post is part of the 2021 C# Advent calendar. Check it out for more C# goodness!
Intro This post contains a very technical dive. It is of intermediate complexity, and assumes a basic knowledge of how async/await works.
.NET 6 introduced a small feature that’s important, but was probably overlooked - Parallel.ForEachAsync.
This is a (IMO) pretty powerful and elegant implementation of something that’s been missing for a while from .
Logging Ideas
I’ve been thinking lately about logging, specifically in C#/.NET. In fact, every few months, I joke around with others at work that I’m going to end up writing my own logging framework.
There are a few things I want from a logging subsytem -
Fast Highly configurable with sane defaults Well-tested Documented Extensible Benchmarked Runtime configurability Instrumented Best effort Integration with .NET logging framework In this post, I’ll expand on these.
My experience with PICO-8
This weekend, I decided to try something different - programming a game in some esoteric environment. Since I don’t have a Commodore 64, I went with the PICO-8, and man did I have fun.
It reminded me a lot of programming in BASIC back in the day, typing in games from magazines and books.
Overview of features Built-in sprite and SFX editors Built-in editor for full retro experience Can edit files outside of the VM as well Pros I really liked at first the idea of programming inside the machine itself, but that quickly got tedious for me.
Object Pool - Proxying calls
Note: This is the second post in a series about an object pooling pattern. You can follow along with code in this repo on Github. The repo will be steps ahead of this series, so don’t worry if there’s things in there I haven’t explained.
Dynamic Proxy Why a Dynamic Proxy Proxy generator Wrapper Combining the wrapper and the interceptor Summary Dynamic Proxy For our proxy object, we’re going to use Dynamic Proxy from the Castle Project.
Object Pool - An Introduction
Note: This is the first post in a series about an object pooling pattern. You can follow along with code in this repo on Github. The repo will be steps ahead of this series, so don’t worry if there’s things in there I haven’t explained.
Overview Real world examples Microsoft SqlClient Ldaptive Components of a pool Object Pool Object Proxy Object Factory Summary Overview An Object pool is a pattern used to maintain a pool of objects (natch) that is useful in situations where initialization of those objects is expensive, such as database connections or network connections in general.