How to check if a section in MVC Core configuration file exist?
问题 How can I check if a specific section in loaded ASP.NET Core configuration file exist? I have a JSON configuration file that I load it in Startup class via ConfigurationBuilder.AddJsonFile method. This JSON file is an array with this layout: { "Url": "", "Regex": [ "", "" ], "Keys": { "Title": "", "Description": "", "Keywords": [ "" ] } } But some of them doesn't have Keys . I tried to check return type of section.GetSection("Keys") against null , But it doesn't return null even if Keys