I'm writing an application using C#, normally a VB user, so have been thrown a few easily solveable curve balls with the syntax differences, until this...
I have a couple of string paths in my Application Settings e.g. *AppSetting_SourceFolder=C:\SourceFolder* and *AppSetting_DestFolder=C:\DestFolder\Processed*
in my code I have a FileSystemWatcher that is watching the source folder and for certain files that appear in the source folder, they are processed and moved to the destination folder. My issue is that when I pull my folders names from the settings into variables or the FileSystemWatcher they don't comeout as expected.
string sSourcePath = MyNameSpace.Properties.Settings.Default.AppSetting_SourceFolder;
string sDestPath = MyNameSpace.Properties.Settings.Default.AppSetting_DestFolder;
and I watch the variables at runtime is see that
sSourcePath contains "C:\\SourceFolder\\"
and sDestFolder contains "C:\\DestFolder\\Processed\\"
I've looked at using the string literal @
infront of my setting reference:
string sSourcePath = @MyNameSpace.Properties.Settings.Default.AppSetting_SourceFolder;
string sDestPath = @MyNameSpace.Properties.Settings.Default.AppSetting_DestFolder;
and also infront of my variable name:
string @sSourcePath = MyNameSpace.Properties.Settings.Default.AppSetting_SourceFolder;
string @sDestPath = MyNameSpace.Properties.Settings.Default.AppSetting_DestFolder;
and also infront of my both parts:
string @sSourcePath = @MyNameSpace.Properties.Settings.Default.AppSetting_SourceFolder;
string @sDestPath = @MyNameSpace.Properties.Settings.Default.AppSetting_DestFolder;
but the outcome doesn't change. What do i have to do to get rid of the extra \
's?
Just to note, when I watch @MyNameSpace.Properties.Settings.Default.AppSetting_SourceFolder
and @MyNameSpace.Properties.Settings.Default.AppSetting_DestFolder;
the result is the same (lots of double \
's).
What am doing (or not doing) wrong? Thanks Steve