Why does this verbatim line not work, as I expect for the unit test assert and showing a strange value in the debugger?

enter image description here

QUESTION: Why does the debugger show "directagents \ a \ aanodide" instead of the verbatim @directactents \ aanodide string value.

UPDATE This seems like a ReSharper quirk. Playback:

  • Enter a string with the letter "\ a".
  • Apply "Change to Verbal Sring" refactoring
    • "\ a" becomes invisible on the string
    • "\ a" has not actually disappeared.

More evidence from the immediate window showing Hand Typed VS. Copy paste. enter image description here

+4
source share
1 answer

The debugger does not know that you are using the verbatim compiler to create a string. It simply displays the string using the most common representation, which is not verbatim.

A string string, in addition to accepting a new string, also does not recognize escape sequences, therefore \ a, which is a bell character, ends as two characters in one case and as one character when it does not use a style in the transcript.

You can find the link for C # string literals here .

+4
source

Source: https://habr.com/ru/post/1344648/


All Articles