Skip to content

Instantly share code, notes, and snippets.

@MongkonEiadon
Last active April 4, 2017 06:59
Show Gist options
  • Save MongkonEiadon/03d5194c2b76465b7dbeb1df5f94315e to your computer and use it in GitHub Desktop.
Save MongkonEiadon/03d5194c2b76465b7dbeb1df5f94315e to your computer and use it in GitHub Desktop.
Legacy Configuration Helper class
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