public class Bar
{
public static readonly string Foo = ConfigurationManager.AppSettings[\"Foo\"];
}
In the .NET Framework 4.x, I can use the
Add this in AppSettings.json file
"Swagger": { "Title": "API DEVELOPMENT" }
Then configure that in Startup.cs file
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
Next get the value from appsettings.json
var title = Configuration.GetSection("Swagger:Title").Value;
Finally put here
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = title, Version = "v1" }); }