class ServiceCreator<T> {}
interface I
{
void Publish<T>(T serviceInstance) where T : class;
void Publish<T>(ServiceCreator<T> serviceCreator) where T : class;
}
interface ISampleService {}
class C
{
public void Foo (I i)
{
i.Publish<ISampleService> (null);
}
}