例如:

public static IConfigurationSection GetSection(this string configName, string path, string configDir = null)
        {
            string configFile = configName.GetConfigPath(configDir);
            ConfigsCache.TryGetValue(configFile, out var detail);
            return detail?.Config?.GetSection(path);
        }

 

像最后return语句里面的?.的意思是:如果前面的detail不为空,则执行后面的Config,以此类推。

相关文章:

  • 2021-11-09
  • 2021-12-17
  • 2022-12-23
  • 2021-12-15
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-15
  • 2022-12-23
  • 2022-01-08
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案