var values = new NameValueCollection
{
{ "key", ConfigurationSettings.AppSettings["API-Key"].ToString() },
{ "image", Convert.ToBase64String(File.ReadAllBytes(photo.ToString())) }
};
What's the new way to use the app.config file?
var values = new NameValueCollection
{
{ "key", ConfigurationSettings.AppSettings["API-Key"].ToString() },
{ "image", Convert.ToBase64String(File.ReadAllBytes(photo.ToString())) }
};
What's the new way to use the app.config file?
Use the System.Configuration.ConfigurationManager class
Edit - added
Note, you may have to add a reference to System.Configuration.dll. Even if you can import the namespace without the reference, you will not be able to access this class unless you have the reference.
With the ConfigurationManager class
http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx
The
ConfigurationManager
class inSystem.Configuration
:So your code would change to:
Make sure you add a reference to
System.Configuration
along with theusing
statement forSystem.Configuration
.The new class to use is the ConfigurationManager class.