Home
Manage Your Code
Snippet: Returns app setting (C#)
Title: Returns app setting Language: C#
Description: get app setting as type. It needs subsonic Views: 664
Author: Kevin Isom Date Added: 11/11/2007
Copy Code  
1public static t AppSetting<t>(string key)
2{
3	t result = default(t);
4
5	if (ConfigurationManager.AppSettings[key] != null)
6	{
7		object paramValue = ConfigurationManager.AppSettings[key];
8		result = (t)SubSonic.Utilities.Utility.ChangeType(paramValue, typeof(t));
9	}
10
11	return result;
12}
13