Creating a file path in C#
- by Jason
So I'm trying to create a path in C#. I use Environment.Machinename and store it a variable serverName. Then I create another string variable and have some other path extension in there. Here is my code so far:
string serverName = Environment.MachineName;
string folderName = "\\AlarmLogger";
No matter what I do I can't seem to obtain only one backslash prior to AlarmLogger. Any ideas how I can specify a path in C#?
Edit: I'm wondering if my code doesn't seem to want to paste correctly. Anyways when i paste it I only see one backslash but my code has two. Because of the escape character sequence. But something like
string test = @"\" + serverName + folderName
doesn't seem to want to work for me.