none
[VB]Displaying Arrays In DebuggerDisplayAttribute RRS feed

  • Question

  • I have started using the DebuggerDisplayAttribute for some of my classes. My classes often include (just like those of many other people) arrays. However, I have not found a way to display arrays (all the values in the array as a string, such as {0,1,2,3,4}) with the DebuggerDisplayAttribute. I know that I could just override the ToString() method, but this is not always appropriate if I want that for something else. Is there an easy way to display an array with DebuggerDisplayAttribute?

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Sunday, August 18, 2019 5:20 AM

All replies

  • Perhaps something like this?
    <DebuggerDisplay("Array = {String.Join("", "", Array)}")>

    With kind regards
    Friday, August 23, 2019 7:32 AM
  • Hi Nathan Sokalski,

    Sorry for delay in reply.

    For your requirement, you could use "Values" which is a property of "DebuggerDisplay" to display the array. Please refer more this thread (though it is based on C#): https://stackoverflow.com/a/39138224

    And you could learn more about properties here: DebuggerDisplayAttribute Class

    Best Regards,

    Dylan

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Tuesday, August 27, 2019 10:02 AM