Skip to content

Instantly share code, notes, and snippets.

@timgabrhel
Last active August 29, 2015 14:08
Show Gist options
  • Save timgabrhel/61f1b5064b711abcf6e3 to your computer and use it in GitHub Desktop.
Save timgabrhel/61f1b5064b711abcf6e3 to your computer and use it in GitHub Desktop.
CloudConfigurationManager.GetSetting Helper
public static bool GetSetting<T>(string key, ref T output)
{
var value = CloudConfigurationManager.GetSetting(key);
if (string.IsNullOrWhiteSpace(value) == false)
{
try
{
output = (T) Convert.ChangeType(value, typeof (T));
return true;
}
catch (InvalidCastException ex)
{
return false;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment