C# ConfigurationManager not returning value -
i'm trying value configuration file
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="musicpath" value="c:/users/alvaro/music" /> </appsettings> </configuration>
and how handle it
this.config = new configurationhandler(); string musicpath = this.config.musicpath(); directoryinfo dinfo = new directoryinfo(musicpath);
and configurationhandler
class
namespace raggaerplayer.class { class configurationhandler { public string musicpath() { string path = configurationmanager.appsettings["musicpath"]; homecoming path; } } }
but got error @ directoryinfo
variable "value cannot null".. doing wrong?
i believe file should named app.config. rename it, think causes versioning problems.
c#
No comments:
Post a Comment