Created
December 17, 2015 16:01
-
-
Save Kazuki-Kachi/923116e91bbb54427bd1 to your computer and use it in GitHub Desktop.
For blog
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
using System.Text; | |
namespace ConsoleApplication | |
{ | |
class Program | |
{ | |
interface IHoge<out T> | |
{ | |
T Foo(); | |
} | |
class Hoge<T> : IHoge<T> where T : new() | |
{ | |
public T Foo() => new T(); | |
} | |
static void Main(string[] args) | |
{ | |
var hoge = new Hoge<StringBuilder>(); | |
IHoge<object> ihoge = hoge; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment