publicclassMyService{privatereadonlyISettingProvider_settingProvider;//Inject ISettingProvider in the constructorpublicMyService(ISettingProvidersettingProvider){_settingProvider=settingProvider;}publicasyncTaskFooAsync(){//Get a value as string.stringuserName=await_settingProvider.GetOrNullAsync("Smtp.UserName");//Get a bool value and fallback to the default value (false) if not set.boolenableSsl=await_settingProvider.GetAsync<bool>("Smtp.EnableSsl");//Get a bool value and fallback to the provided default value (true) if not set.boolenableSsl=await_settingProvider.GetAsync<bool>("Smtp.EnableSsl",defaultValue:true);//Get a bool value with the IsTrueAsync shortcut extension methodboolenableSsl=await_settingProvider.IsTrueAsync("Smtp.EnableSsl");//Get an int value or the default value (0) if not setintport=(await_settingProvider.GetAsync<int>("Smtp.Port"));//Get an int value or null if not providedint?port=(await_settingProvider.GetOrNullAsync("Smtp.Port"))?.To<int>();}}