a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
21 lines
352 B
C#
21 lines
352 B
C#
public static class CoalescingWithGenericsBug
|
|
{
|
|
class Service { public void Foo () { } }
|
|
|
|
static T Provide<T> () where T : class
|
|
{
|
|
return FindExisting<T> () ?? System.Activator.CreateInstance<T> ();
|
|
}
|
|
|
|
static T FindExisting<T> () where T : class
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public static int Main ()
|
|
{
|
|
Provide<Service> ().Foo ();
|
|
return 0;
|
|
}
|
|
}
|