Reputation: 2426
I'm looking for a feature or extension similar to the one present in IntelliJ
that escapes backslashes automatically while copy/pasting windows paths into the code. Are there any ?
Upvotes: 3
Views: 7113
Reputation: 35681
ReSharper does it seamlessly but of course, it costs money.
There's also a free VS extension that does that, here: https://marketplace.visualstudio.com/items?itemName=martinw.SmartPaster2013
Upvotes: 4
Reputation: 14066
If you are pasting paths into strings in C# code then the language provides a string style where backslashes do not need escaping. Just prefix the string with an @
character. These two strings are the same:
string aaa = @"C:\some\path\to\a.file";
string bbb = "C:\\some\\path\\to\\a.file";
Upvotes: 4