Debugging is an essential part of software development. Programmers are running their applications and checking if algorithms and workflows are working as expected.
There are so-called “debuggers” which are special utilities designed to interrupt applications and provide information about states of variables, their values. Visual Studio by Microsoft is the ultimate debugger for .NET desktop and web applications.
It provides a lot of features and functions helping programmers to debug and inspect their apps faster and better. But still, there is room for some special tools and this is where ByteScout can help you.
While debugging .NET applications you may easily visualize the content of Bitmaps and Streams using our free plugins like Bitmap Visualizer (Visual Studio Marketplace)
But how to preview arrays? Microsoft Visual Studio is not allowing the making of plugins to visualize the content of arrays but you may easily visualize arrays while debugging your .NET code using this simple trick.
First, create this code in your application that will extend the Array class:
#if DEBUG public static class ArrayExtension { public static string ToString2(this Array arr) { StringBuilder stringBuilder = new StringBuilder(); foreach (object o in arr) { stringBuilder.Append(o); stringBuilder.Append(", "); } return stringBuilder.ToString(); } } #endif
Then run your application and then you may preview the content of your array (say, you have array variable which is Array) by right-clicking on the variable, then select Quick Watch and type array.toString2():
Happy debugging!