Shalvin.Com                                                                                                                      Home

Hybrid Dictionary

This is part I of HybdidDictionary article. In this article we take up creating a data entry application using HybridDictionary.
In the
Binary Serializing a Hybrid Dictionary article we will take up Serializing the HybridDictionary for later use.

HybridDictionary is optimized for key-based item retrieval from both small and large collections.

A DictionaryEntry structure is used for retieving the key and value of an IDictionary.

 

using System.Collections;
using System.Collections.Specialized;

HybridDictionary hd = new HybridDictionary();

private void btnAdd_Click(object sender, EventArgs e)
{
  hd.Add(txtEmpCode.Text, txtEmployeeName.Text);
  MessageBox.Show("Value added");
  BlankControls();
}

private void BlankControls()
{
  txtEmpCode.Text = ""; txtEmployeeName.Text = "";
  txtEmpCode.Focus();
}

private void btnDisplayItems_Click(object sender, EventArgs e)
{
  listBox1.Items.Clear();
  foreach (DictionaryEntry de in hd)
    listBox1.Items.Add(de.Key + " " + de.Value);
}    

  


Contact : shalvin@gmail.com