Last active
April 4, 2017 06:59
-
-
Save MongkonEiadon/03d5194c2b76465b7dbeb1df5f94315e to your computer and use it in GitHub Desktop.
Legacy Configuration Helper class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
public class ConfigHelper | |
{ | |
public static string GetAppSetting(string key, string defaultValue = null) | |
{ | |
var result = defaultValue; | |
var val = ConfigurationManager.AppSettings[key]); | |
if (!val != null) | |
{ | |
result = val; | |
} | |
return result; | |
} | |
} | |
public class ApiService | |
{ | |
public void ReadBotConfiguration() | |
{ | |
var appId = ConfigHelper.GetAppSetting("AppId", ""); | |
var appPassword = ConfigHelper.GetAppSetting("AppPassword", ""); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment