dc

dc

  • NA
  • 663
  • 0

C# directory

Jan 28 2013 2:29 PM
In a C# 2010 desktop application, I have the following code:

string Format_Date = DateTime.Now.AddMonths(-1).ToString("MM-yyyy");

string filesaveLocation = ConfigurationSettings.AppSettings["Location"] + "\\" + Format_Date + "\\";

  if (Directory.Exists(filesaveLocation))

When the value is displayed from  filesaveLocation the value: "C:\\\\Trans\\12-2012\\".

The problem is once I get to the following line of code:
if (Directory.Exists(filesaveLocation)) the same is always true.

It does not make any difference if I say (!Directory.Exists(filesaveLocation)).

This answer is true also.

Thus can you show me in code how to correct this problem?

Answers (6)