对空传播感到困惑

时间:2021-03-02 07:42:09

标签: c# null

我尝试了几种方法,但无法将以下语句转换为空传播。

可能,我不知道它是如何工作的。

            Host.CreateDefaultBuilder(args)
             .ConfigureAppConfiguration((hostingContext, config) =>
             {
                 var env = hostingContext.HostingEnvironment;
                 config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                 .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
                 
                 config.AddEnvironmentVariables();
             })
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            });

1 个答案:

答案 0 :(得分:2)