Skip to content

Instantly share code, notes, and snippets.

using System;
public class InferenceTest {
static void Main() {
var superAction = new Action<ISuper>(SuperAction);
var superDummyFunc = new Func<ISuper, object>(SuperDummyFunc);
var subFunc = new Func<ISub>(SubFunc);
var subDummyFunc = new Func<object, ISub>(SubDummyFunc);
var covariantObj = (ICovariant<ISub>)null;
var contravariantObj = (IContravariant<ISuper>)null;
var invariantCovariantObj = (IInvariant<ICovariant<ISub>>)null;
@colinjneville
colinjneville / CS1540.cs
Created December 7, 2017 23:00
Mono CS1540 test case
using System;
static class M {
static void Main()
{
B b = new B();
// Outside the scope of the B members, the A members are used
var x = b.Property;
b.Method();
b.Field = true;