Mukil Deepthi
Mukil Deepthi

Reputation: 6482

C# How to maintain the path as in string without replacing double slash

I have a string with value

"\\test\mxf\123456\123456789.abc"

When I use

var x= @"\\test\mxf\123456\123456789.abc"

I am getting an output as

"\\test\\mxf\\123456\\123456789"

How to get the string as a path i.e "\\test\mxf\123456\123456789.abc" without the double slashes getting replaced?

Upvotes: 0

Views: 938

Answers (2)

sowjanya attaluri
sowjanya attaluri

Reputation: 911

Try this,

var x = "\"" + @"\\test\mxf\123456\123456789.abc" + "\"";;

Console.WriteLine(x); 

Upvotes: 0

Zein Makki
Zein Makki

Reputation: 30052

Use Console to check strings and not the debugger :

var x= @"\\test\mxf\123456\123456789.abc"

Console.WriteLine(x); // output is \\test\mxf\123456\123456789.abc

Upvotes: 6

Related Questions