C# Quines

Writing quines is a fun way to while away an afternoon, especially when trying to make them as short as possible. This is the result of my attempt at writing the shortest C# quine possible (155 characters, source file): class q{static void Main(){string s=”class q{{static void Main(){{string s={0}{1}{0};System.Console.Write(s,’{0}’,s);}}}}”;System.Console.Write(s,’”‘,s);}} PS: I came across a shorter C# [...]

Crouching Enumerator, Hidden Boxing

A few months ago, I was playing around with a simple C# permutation generator to build a word list, with each character position having its own list of characters to iterate through: List<T>.Enumerator enumerator = characterList.GetEnumerator(); while (condition) { if (!enumerator.MoveNext()) { enumerator.Reset(); enumerator.MoveNext(); } Consume(enumerator.Current); } Oddly, I was getting a compilation error on [...]