title: Configuring Swagger with values from Iconfiguration object
body: <p>I am trying to configure swagger in startup.cs. If I give its required values "Hardcoded" like below  <code>in ASP.NET Core : 2.2</code></p>
  
  <pre><code>    services.AddSwaggerGen(c =&gt;
      {
        c.SwaggerDoc("V1", new Info { Title = "MY.API", Version ="v1" });
      });
  
      app.UseSwagger();
      // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), 
      // specifying the Swagger JSON endpoint.
      app.UseSwaggerUI(c =&gt;
      {
          c.SwaggerEndpoint("/swagger/v1/swagger.json", "MY.API V1");
      });
  </code></pre>
  
  <p>but if i set all above hard coded values from "IConfiguration" object provided by asp.net core, then it stop working, </p>
  
  <pre><code>services.AddSwaggerGen(c =&gt;
  {
     c.SwaggerDoc(this.Configuration.GetSection("AppSetting") 
     ["APIName"], new Info { Title = "My.API", Version = "v1" });
  }); 
  </code></pre>
  
  <p>OS: Windows 10 Pro</p>