title: What is the purpose of IServiceProvider.GetService(Type serviceType)?
body: <p>I am implementing a new .NET Core project and working on dependency injection for my service layer. I created an interface that implements <code>IServiceProvider</code> and now must implement <code>GetService(Type serviceType)</code>. This is my interface.</p>
  
  <pre><code>public interface INewsService : IServiceProvider
  {
      IEnumerable&lt;string&gt; GetAllSources();
  }
  
  public class NewsService : INewsService
  {
      private readonly INewsRepository _newsRepository;
  
      public NewsService(INewsRepository newsRepository)
      {
          _newsRepository = newsRepository;
      }
  
      public IEnumerable&lt;string&gt; GetAllSources()
      {
          return _newsRepository.GetAllSources();
      }
  
      public object GetService(Type serviceType)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>What is the purpose of the method? Reading through the <a href="https://msdn.microsoft.com/en-us/library/system.iserviceprovider.getservice(v=vs.110).aspx" rel="nofollow noreferrer">MSDN documentation</a>, it's really vague and doesn't clear it up too much. My code runs when I start it...so I'm not sure what it is needed for.</p>