I\'ve been using string interpolation and loving it, however I have an issue where I am trying to include a backslash in my output, but am not able to get it to work.
Hi the rule for escape the back slash in interpolated string is duplicate the back slash:
var domain = "mydomain";
var userName = "myUserName";
var combo = $"{domain}\\{userName}";
but if you also use the interpolated string as verbatim string then you don't need to escape the back slash:
var domain = "mydomain";
var userName = "myUserName";
var combo = $@"{domain}\{userName}";
and you get the same:
For a tutorial about interpolated string: see video interpolated string