Skip to content

Instantly share code, notes, and snippets.

View jskeet's full-sized avatar
💭
Very happily employed. I do not wish to hear from recruiters.

Jon Skeet jskeet

💭
Very happily employed. I do not wish to hear from recruiters.
View GitHub Profile
using System;
using System.Linq;
using System.Windows.Forms;
class Test
{
public static void Main()
{
var combo = new ComboBox
{
using System;
using System.Collections.Generic;
using System.Linq;
class Test
{
static void Main()
{
var voterA = new List<int> { 1, 2, 3, 4, 7 };
var voterB = new List<int> { 5, 2, 0, 1 };
// This is a .NET 3.5 console app, compiled with the C# 6 compiler from CTP6
using System;
namespace System.Runtime.CompilerServices
{
public class FormattableStringFactory
{
public static FormattableString Create(string messageFormat, params object[] args)
{
return new FormattableString(messageFormat, args);
@jskeet
jskeet / gist:a404e6c296e5afeac27f
Created March 13, 2015 18:31
Demo of oddity for 13.5.1
using System;
public class Base
{
public void Foo()
{
Console.WriteLine("Foo");
}
}
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace ConsoleExRun
{
class Program
{
[STAThread]
static void Main(string[] args)
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace ConsoleExRun
{
class Program
{
[STAThread]
static void Main(string[] args)
/* Stop Twenty Fourteen from being so narrow */
content .entry-header, .site-content .entry-content, .site-content .entry-summary, .site-content .entry-meta, .page-content, .comments-area {
max-width: 800px;
}
using System;
using System.Collections.Generic;
using System.Linq;
class Entry {}
class WordEntry : Entry {}
class CharacterEntry : Entry {}
class Program
{
using System;
using System.Text;
class Test
{
// Notes:
// The target of the builder.Length assignment is evaluated before
// any of the assignments actually happen - in particular, before the
// builder assignment from the first element of the tuple.
//
public static string FizzBuzz(int n)
{
var fizz = Test(3, "fizz");
var buzz = Test(5, "buzz");
return fizz(buzz(x => x))(n.ToString());
Func<Func<string, string>, Func<string, string>> Test(int d, string s) =>
x => n % d == 0 ? _ => s + x("") : x;
}