help to put directory path to app.config file

  • Thread starter Vicky via DotNetMonster.com
  • Start date
V

Vicky via DotNetMonster.com

Please help to put directory path to app.config file!

//DirectoryInfo di = new DirectoryInfo("C:\\Vicky Development\\FundExplorer\
\Index\\Copy of IntlIndex");

//string dipath = @"C:\Vicky Development\FundExplorer\Index\Copy of
IntlIndex";

//DirectoryInfo di = new DirectoryInfo(dipath);

System.Configuration.AppSettingsReader appReader =

new System.Configuration.AppSettingsReader();

string diPath = (string)appReader.GetValue(

"DirectoryPath",typeof(string));

DirectoryInfo di = new DirectoryInfo(diPath);

// Get a reference to each file in that directory.

FileInfo[] fiArr = di.GetFiles();
 
G

Guest

Hi Vicky,

All you need to do is remove the "@" and the ";" from your configuration
file, e.g:

<add key="DirectoryPath" value="C:\VickydDevelopment\FundExplorer\Index\Copy
of IntlIndex" />

Cheers,

-Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top