Hi,
I have the following bit of code:
private static T GetConfigValue2<T>(string key)
{
int value = 0;
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings[key]))
{
int.TryParse(ConfigurationManager.AppSettings[key], out value);
}
return value;
}
I want to do an int.tryparse for int values, does anyone know how to test the type T for an int???
Also how to make the return of the function generic as the values would be string, int and double.
Thanks
I have the following bit of code:
private static T GetConfigValue2<T>(string key)
{
int value = 0;
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings[key]))
{
int.TryParse(ConfigurationManager.AppSettings[key], out value);
}
return value;
}
I want to do an int.tryparse for int values, does anyone know how to test the type T for an int???
Also how to make the return of the function generic as the values would be string, int and double.
Thanks