Captured variables

This article is about captured variables in C#.  In case you've not come across them before, they're where some code appears to capture and drag with it a variable declared outside the code, such that the code can continue using the variable long after it appears that this should be possible. They’re not something I … Continue reading Captured variables

Covariance and contravariance, part 2: Contravariance in interfaces

This is part two in a series about variance – contravariance and covariance. Arrays and listsContravariance in interfacesCovariance in interfaces In the previous article I introduced the concepts of variance and type size.  I also gave arrays as an example of covariance. In this article I’ll give an example of contravariance, and go into more … Continue reading Covariance and contravariance, part 2: Contravariance in interfaces

Covariance and contravariance – part 1: Arrays and lists

This post is the first in a series - for once I will split a large topic into a few small posts. The series is about covariance and contravariance, together known as variance. Arrays and listsContravariance in interfacesCovariance in interfaces Covariance and contravariance are terms I came across occasionally, and never understood properly. Having put … Continue reading Covariance and contravariance – part 1: Arrays and lists

P = NP?

This article is my attempt to put my money where my mouth is.  A friend mentioned the BBC Radio 4 series In Our Time on Facebook, and in the conversation that followed I said that the only time In Our Time discussed something close to my home turf I got grumpy about how poorly I … Continue reading P = NP?

Random numbers to protect privacy in a pandemic app

A computer system, like a car or a coffee machine, is something designed to meet some requirements.  These requirements usually force the designer to make a compromise, based on which requirements get more attention than others.  (Which is the best car?  It depends on whether speed, size, sustainability etc. are most important to you.) One … Continue reading Random numbers to protect privacy in a pandemic app