Created
August 1, 2012 19:47
-
-
Save ianbattersby/3230065 to your computer and use it in GitHub Desktop.
Mono variance validity issue?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ContravariantIssue.cs(3,26): error CS1961: The contravariant type parameter `TSomething' must be | |
// covariantly valid on `ContravariantIssue.In.Mono.Example.IInterface<TSomething>.Something' | |
namespace ContravariantIssue.In.Mono.Example | |
{ | |
public interface IInterface<in TSomething> | |
{ | |
TSomething Something { set; } | |
} | |
public interface TSomething | |
{ | |
string FieldOne { get; set; } | |
string FieldTwo { get; set; } | |
} | |
public class Something : TSomething | |
{ | |
public string FieldOne { get; set; } | |
public string FieldTwo { get; set; } | |
} | |
public class ContraExample : IInterface<Something> | |
{ | |
public Something Something { private get; set; } | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment