title: How to return T type?
body: <p>I have generic method:</p>
  
  <pre><code>private ILogger _logger; //get logger something else.
  public T GetService&lt;T&gt;(ServiceType type)
  {
   //how to return _logger?
  }
  </code></pre>
  
  <p>How can i return T?
  For example, i have ILogger:</p>
  
  <pre><code>var logger=GetService&lt;ILogger&gt;(log);
  </code></pre>
  
  <p>How to implement GetService method?
  Thank you!</p>
  
  <p>P.S. yes, i try to get one and more types from GetService method. 
  For example: Logger, some other infrastructure classes.
  I know, that ServiceLocator is not right choise (is it uses in many places),but in my way (GetService will be use in one place: to get infrastructure  for my plugins) i hope it is normal.</p>