Is it possible to assign a System.Diagnostics.DebuggerDisplay attribute to the definition of a Dictionary?
e.g.
Dictionary<int, SomeClass>
[System.Diagnostics.DebuggerDisplay("{Info,nq}")]
public class SomeClass{
string code {get;set;}
public string Info { get { return "info" + code; }}
}
// place an attribute here??
[System.Diagnostics.DebuggerDisplay("{???,nq}")]
Dictionary<int, SomeClass> dict = new Dictionary<int, SomeClass>();
EDIT: see also this answer.
I haven’t tried it, but from the documentation, it’s possible to apply this attribute at the assembly level. So in theory, you could do something like this:
I’d be surprised if it lets you get away with specifying a
Targetwhich is an open generic type, e.g.Target = typeof(KeyValuePair<,>)which would work for a KVP of any type. But if you need that, it’s worth a try!