I tried to create a visualizer for an IDictionary or ICollection
Then, like a simple visualizer (without dialogue, I mean the visualizer of the input line that appears when the variable hangs, see the figure below), I want to create my own text, I want the collection to be included in its list of types (IE StringCollection to List (Of String) or List), and then I can see it in the visualizer. Or for dictionaries, show lists of visualizers for keys and values.
Any ideas on how to implement or even start?
I will update my question soon.
This is what I was thinking:
using System.Collections.Specialized; using System.Collections; namespace ConsoleApplication2 { static class Program { static void Main(string[] args) { System.Collections.Specialized.StringCollection collection = new StringCollection(); collection.AddRange(new string[] { "string1", "string2", "sting3" }); string[] visualizable = collection.ConvertToVisualizableList(); Dictionary<string,string> dic = new Dictionary<string,string> { {"key1","value"}, {"key2","value"} }; string[,] visualizable2 = dic.ConvertToVisualizableDictionary(); } static string[] ConvertToVisualizableList(this IList collection) { lock (collection) { if (collection == null) return null; int length = collection.Count; string[] list = new string[length]; for (int i = 0; i < length; i++) { object item = collection[i]; if (item != null) list[i] = item.ToString(); } return list.ToArray(); } } static string[,] ConvertToVisualizableDictionary(this IDictionary dictionary) { if (dictionary == null) return null; int length = dictionary.Count; string[,] list = new string[length, 2]; int i = 0; foreach (object item in dictionary.Keys) { list[i, 0] = item.ToString(); object value = dictionary[item]; if(value!=null) list[i, 1] = value.ToString(); i++; } return list; } } }
These are VS visualizers for arrays and multidimensional arrays:

I want to use something like this for ICollection (or IList), IDictionary, etc.
Note that in arrays, the visualizer shows each nested object. In fact, I want to achieve :
.
Try to visualize the list and you will see that there is a _items personal value so that you can see its elements. I want to achieve something similar in the collection and dictionary.