.net core获取appsettings CustomSettings

落花踏尽游何处,笑入胡姬酒肆中。这篇文章主要讲述.net core获取appsettings CustomSettings相关的知识,希望能为你提供帮助。

private static string GetCustomSettings(string key) { var config = new ConfigurationBuilder() .AddInMemoryCollection() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .Build(); return config.GetSection("CustomSettings").GetValue(key, string.Empty); } // 获取自定义value public static string WXWarningClosedTemplateID => GetCustomSettings("xxx");

【.net core获取appsettings CustomSettings】 

    推荐阅读