Skip to content

Instantly share code, notes, and snippets.

View Squares.cs
public static class Squares
public static int Square(int i) => i * i;
public static int SumOfSquares(int i) => Enumerable.Range(1, i).Select(Square).Sum();
markrendle / IXmlSerializable.cs
Last active Mar 2, 2018
SXmlSerializable shape for fixing Jon Skeet's problems in C# 9.0
View IXmlSerializable.cs
The IXmlSerializable interface assumes the mutability of the type the implements it.
Now we have readonly structs, that's not a valid assumption. Ideally, there'd be a static
method that returned a new instance of the type, but you can't have static methods on
interfaces, because reasons.
public interface IXmlSerializable
export PS1='\n[\e[0;32m\u@\h\e[m \e[1;33m\w\e[m\e[0;31m$(__git_ps1 " (%s)")\e[m]\n\$ '
markrendle /
Created Apr 4, 2017
Mark's Bio for conferences and such

Mark is the founder and CTO of RendleLabs, a software development consulting company. He works with new and emerging technologies, and shares his experience with teams and organisations looking to adopt those technologies for their projects. Currently Mark specializes in .NET Core and helps teams get up to speed with the wider ecosystem opened up by this cross-platform version of .NET; things like Linux, Docker, microservice architectures and so on. Mark also contributes to various open source projects, and speaks at conferences and user groups around the world. He is a Microsoft Azure MVP and a Docker Captain. In his spare time, he enjoys gaming, watching movies, and putting off writing his (probably best-selling) book.

markrendle /
Created Feb 2, 2017
.NET Core, The Universe, and Everything

.NET Core, The Universe and Everything

.NET Core finally brings a fully-supported, open-source version of the framework cross-platform, and with the 2.0 release due in Spring, it's really ready for prime-time. While C# and .NET are familiar, the new ecosystem in which whey find themselves is bigger and more open than ever before, and the design and architecture of the systems you can build is very different from the "ASP.NET hosted in IIS" model you're used to.

Join Mark as he shares some of what he's learned from working with ASP.NET Core since the very first preview release of Project K through to version 1.1, including:

markrendle /
Last active Dec 19, 2016
The 9 Arbitrary Rules Of Object Pilates

Object Pilates outlines 9 completely arbitrary and hopelessly unrealistic rules to apply when performing the exercise:

  • One primitive parameter per method.
  • Don't use the subtract operator.
  • Wrap all increment operations in static methods.
  • Singly-linked lists.
  • One underscore per file.
  • Don't loop.
  • Keep all solutions less than 529 lines.
  • No methods with more than two callers.

Thoughts on project files

I missed last night's ASP.NET Community Standup on account of being shattered after a long day and falling asleep. Then I checked Twitter on the train this morning and discovered that the .NET world had, apparently, been burned to the ground by marauding Microsofties (again). It seemed to have something to do with project files, JSON vs XML, and suchlike.

Finally, lunchtime happened and I could watch the recording of the standup, and I got to understand what everyone was on about. In case you've missed it:

The TL;DR history

  1. In the beginning, there was make, and Gates did not own make, so Gates said "Let there be MSBuild" and there was MSBuild.
  2. And MSBuild used the *.*proj files from Visual Studio as its inputs, which were formed of terrible XML, and verily it was impossible to use without a Visual Studio license.
View Whatever.cs
public class Whatever
public async Task<int> Something()
await Task.Delay(1).ConfigureAwait(false);
await Task.Delay(1).ConfigureAwait(true);
return 0;
markrendle /
Created Feb 22, 2016
Docker script to run `dnx` commands using CoreCLR
#! /usr/bin/env bash
while [ ! -f "${PROJECTDIR}/global.json" ] ; do
if [ $PROJECTDIR == '/' ] ; then
echo No global.json found in any parent directories. Aborting.
exit 1
markrendle / gulpfile.js
Created Nov 5, 2015
Pass an argument to Gulp to only run a subset of Specs
View gulpfile.js
"use strict";
const gulp = require('gulp'),
mocha = require('gulp-mocha'),
minimist = require('minimist');
const knownOptions = {
string: 'spec',
default: { spec: '*' }
You can’t perform that action at this time.