'How to view bytes as char in Watch window (Visual Studio 2017)?
Is it possible to view a byte(s) during debugging as char when it is added to the watch list? There is an option to view as hexadecimal but none for char.
Solution 1:[1]
@GSerg stated the answer in the comments, but it would be better if it was put in an answer.
If you have a variable char []buffer
, you can watch it as a string
if you specify the correct encoding and wrap the buffer with a call to GetString()
. For example, if the encoding was UTF8
, you would use in the watch window:
Encoding.UTF8.GetString(buffer)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Adrian |