Why are you using Assert.ReplaceNullChars (line input)?

Why are you using Assert.ReplaceNullChars (line input)?

I searched, but cannot find, cases when anyone really uses this. Even MSDN does not help. All I can find out is:

ReplaceNullChars - Replaces the null characters in the string \ 0 with \\ 0

This is not like anything that is useful to me, and I am surprised at this in the Assert class.

+6
source share
1 answer

Most likely, you can print a string containing null characters for better diagnosis, since printing a string that contains a char zero does not usually lead to anything meaningful (this will usually be truncated in the output).

However, the best way would be Assert.EscapeNonprintableChars - to replace not only \0 , but also all non-printable characters.

+6
source

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


All Articles