public static class ConfigManager { public static string GetSetting(string name) { var result = Environment.GetEnvironmentVariable(name); if (string.IsNullOrWhiteSpace(result)) { result = ConfigurationManager.AppSettings[name]; } return result; } public static int? GetIntSetting(string name) { var s = GetSetting(name); if (int.TryParse(s, out int result)) return result; return null; } public static DateTime? GetDateSetting(string name) { var s = GetSetting(name); if (DateTime.TryParse(s, out DateTime result)) return result; return null; } }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.