views:

108

answers:

2

I am trying to do something like this on an indexer class:

    [DebuggerDisplay("Debug: {_Items[index]}")]
    public override string this[byte index]

However, when the debugger evaluates the string, the message in the value field is "index does not exist in the current context".

Is there some way to use the DebuggerDisplay attribute to controle the display of a single element within an indexer class??

A: 

Edit: I really am not confident of the OP's question. This is how you can get a collection type to show its members as a list in the debugger.

Place the following attribute on a field or property that is "an array or collection", perhaps it checks for an implementation of IList<T>?

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
280Z28
A: 

Try

Debug: {Items[{index}]}
amazedsaint