Click here to Skip to main content
15,881,092 members
Articles / Programming Languages / C#

A Generic List and Dictionary Debugger Visualizer for VS.NET

Rate me:
Please Sign up or sign in to vote.
4.91/5 (36 votes)
27 Aug 2011CPOL2 min read 159.9K   3.8K   103  
A cool List and Dictionary debugger visualizer for VS.NET 2005, 2008 and 2010
using System;
using System.Windows.Forms;
using System.Collections;
using VisualizerLib;

namespace ListVisualizerTest
{
    public partial class DictionaryVisualizer : Form
    {
        #region Constructor

        public DictionaryVisualizer()
        {
            InitializeComponent();
        }

        #endregion

        #region Initialization

        private DictionaryProcessor dictionaryProcessor;

        private void frmDictionaryVisualizer_Load(object sender, EventArgs e)
        {
            Populate populate = new Populate();
            populate.PopulateLists();

            // Get the dictionary
            //IDictionary dict = (IDictionary)populate.DictIntObject;
            IDictionary dict = (IDictionary)populate.DictString;

            // Get the keys in the grid view
            dictionaryProcessor = new DictionaryProcessor(dict);
            dictionaryProcessor.CreateKeyList();
            dictionaryProcessor.GetDictionary(true, null, dgvKeys);

            // Get the first element value
            dgvKeys_CellClick(null, new DataGridViewCellEventArgs(0, 0));
        }

        private void dgvKeys_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            // Get the value in the grid view
            if (dictionaryProcessor.KeyList.Count > 0 && e.RowIndex >= 0 &&
                e.RowIndex < dictionaryProcessor.KeyList.Count)
            {
                dgvValues.Columns.Clear();
                object key = dictionaryProcessor.KeyList[e.RowIndex];
                dictionaryProcessor.GetDictionary(false, key, dgvValues);
            }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Brazil Brazil
I started development 37 years from now, since MSX basic. Started Windows programming with VB 2.0 and Web programming with ASP 3.0. Then I built Windows Forms, Web Applications, NT services and WPF applications using Microsoft.NET. I am MCP in Visual Basic 6.0, MCAD and MCSD.NET in Framework 1.1, MCPD Web in Framework 2.0, MCTS in .NET 3.5 workflow, MCTS in .NET 3.5 communication foundation, windows presentation foundation and MVC applications. Built MVC Web Application and WCF services using Micro Services architecture proposed by me. Working with AI projects to improve the business performance and customer experience. Besides programming I love running, swimming, reading and movies.

Comments and Discussions