I've been using string interpolation and love it. However, I have an issue where I am trying to include a backslash in my output, but I am not able to get it to work.
I want something like this...
var domain = "mydomain";
var userName = "myUserName";
var combo = $"{domain}\{userName}"
I want the output of combo to be:
myDomain\myUserName
I get a syntax error about the \ being an escape character. If I put in \\ then the syntax error is gone, but the output is myDomain\\myUsername.
How can I include escaped characters in an interpolated string?
$@"{domain}\{userName}"
. I think you should try it, and accept it. I had exactly the same problem, down to it also being domain and user name, and his method works fine. – Gaskill