title: How to check if config section exists?
body: <p>I'm trying to implement a simple config service to my dotnet core projects. </p>
  
  <p>I want to <code>return null</code> if requested config section is not present in any of the config files added.</p>
  
  <p>My current code to retrieve a config section:</p>
  
  <pre><code>private static IConfigurationRoot _configuration { get; set; }
  private static IConfigurationBuilder _builder;
  
  public JsonConfigService()
  {
     _builder = new ConfigurationBuilder();
  
  }
  
  public T GetConfigModel&lt;T&gt;(string name) where T : new()
  {
      if (string.IsNullOrWhiteSpace(name))
          return default(T);
  
      var section = _configuration.GetSection(name);
  
      if (section == null || string.IsNullOrWhiteSpace(section.Value))
          return default(T);
  
      var value = new T();
      section.Bind(value);
  
      return value;
  } 
  
  public void RegisterSource(string source)
  {
      _builder.AddJsonFile(source);
      _configuration = _builder.Build();
  }
  </code></pre>
  
  <p>the problem is:</p>
  
  <ul>
  <li>Section is never null whenever the requested config section is available in the config or not.</li>
  <li><code>section.Value</code> is always null (only tested against complex types)</li>
  </ul>
  
  <p>How do i find out if config section "NotHere" is actually in the json file or not before binding?</p>