Get custom classes for configuration information in AppSettings

xiaoxiao2021-03-06  52

Using system; using system.configuration;

Namespace openhack4 {///

/// Web.config Operation class /// public seled class confighelper {/// // gets the configuration string information in AppSettings /// < / summary> /// /// public static string getconfig (string key) {return configurationSettings.appsettings [key];}

///

// gets configuration BOOL value information in AppsetTINGS /// /// /// public Static Bool getConfigBool (String Key) {BOOL RESULT = false; string cfgval = getconfig (key); if (null! = cfgval&& string.empty! = cfgval) {Try {result = BOOL.PARSE (CFGVAL);} catch Formatexception) {// ignore format exceptions.}

Return result;}}}

转载请注明原文地址:https://www.9cbs.com/read-114978.html

New Post(0)