Merge branch 'ConfigHandlerNullRef-_79' into Release0.2

This commit is contained in:
chris.watts90@outlook.com 2017-04-21 08:06:41 +01:00
commit 111bbd99e4

View File

@ -1,4 +1,5 @@
using System.Configuration; using System.Configuration;
using System.Linq;
namespace ConfigurationHandler namespace ConfigurationHandler
{ {
@ -7,7 +8,9 @@ namespace ConfigurationHandler
public static string GetConfiguration(string keyName) public static string GetConfiguration(string keyName)
{ {
var appSettings = ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetEntryAssembly().Location).AppSettings; var appSettings = ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetEntryAssembly().Location).AppSettings;
if(appSettings.Settings.AllKeys.Contains(keyName))
return appSettings.Settings[keyName].Value; return appSettings.Settings[keyName].Value;
return string.Empty;
} }
} }
} }