In C# .Net we see that System.Diagnostics.DebuggerDisplayAttribute
can display customized information during a debugging session. This is useful, and easy to display single values.
But what about arrays? Take the below snippet as an example. I am constantly switching between the two attributes by commenting/uncommenting because I have a usage scenario where MQueue is 5 elements long, and another where it is 2. Is there a way for the DebuggerDisplay attribute to handle arrays so that I don't have to hard-code the display statements?
//[DebuggerDisplay("[{MQueue[0]} {MQueue[1]} {MQueue[2]} {MQueue[3]} {MQueue[4]}]")]
//[DebuggerDisplay("[{MQueue[0]} {MQueue[1]}]")]
internal class State
{
internal List<int> MQueue { get; set; }
}