I want to apply the DebuggerDisplayAttribute
to include an memory address value.
Is there a way to have it displayed in hexadecimal?
[DebuggerDisplay("Foo: Address value is {Address}")]
class Foo
{
System.IntPtr m_Address = new System.IntPtr(43981); // Sample value
System.IntPtr Address
{
get { return m_Address; }
}
}
This will display: Foo: Address value is 43981
Instead, I'd like the value to be displayed in hex, like that: Foo: Address value is 0xABCD
.
I know that I could apply all kinds of formatting by overriding ToString()
, but I'm curious if the same is possible with DebuggerDisplayAttributes.
Thanks in advance!