Skip to content

Instantly share code, notes, and snippets.

@Kazuki-Kachi
Created December 17, 2015 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kazuki-Kachi/923116e91bbb54427bd1 to your computer and use it in GitHub Desktop.
Save Kazuki-Kachi/923116e91bbb54427bd1 to your computer and use it in GitHub Desktop.
For blog
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