Skip to content

Instantly share code, notes, and snippets.

@ericlippert
ericlippert / ambiguous.cs
Created January 20, 2022 22:52
Ambiguous interfaces
public interface I1<U>
{
void M(U i); // generic first
void M(int i);
}
public interface I2<U>
{
void M(int i);
void M(U i); // generic second
}
@ericlippert
ericlippert / Life1978v1.cs
Created February 17, 2021 16:44
1978 BASIC Life line-by-line ported to C#
// This is a line-for-line C# port of a 1978 BASIC implementation of Conway's Life;
// bugs are included as they were in the original program.
// See https://ericlippert.com/2021/02/17/life-part-38/ and
// https://ericlippert.com/2021/02/23/life-part-39/ for details.
using System;
using static System.Math;
public class Program
{
@ericlippert
ericlippert / Combinations.cs
Last active November 29, 2020 02:17
Computing combinations of a sequence in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
// An immutable stack
//
// Note that the class is abstract with a private
// constructor; this ensures that only nested classes
// may be derived classes.