Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (localDict != null)
     {
         ThreadSafeDictionary.AddItem(localDict, "New Item:1", 1);
         ThreadSafeDictionary.AddItem(localDict, "New Item:2", 2);
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     //use two different dictionaries just to show it working
     if (localDict1 != null)
     {
         ThreadSafeDictionary.AddItem(localDict1, "New Item :1", 1);
         ThreadSafeDictionary.AddItem(localDict1, "New Item :2", 2);
     }
     if (localDict2 != null)
     {
         ThreadSafeDictionary.AddItem(localDict2, "New Item :1", 1);
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            // use two different dictionaries just to show it working with
            // different data types (i.e. we could use class objects too)
            if (localDict1 != null)
            {
                ThreadSafeDictionary <int> .AddItem(localDict1, "New Item :1", 1);

                ThreadSafeDictionary <int> .AddItem(localDict1, "New Item :2", 2);
            }
            if (localDict2 != null)
            {
                ThreadSafeDictionary <string> .AddItem(localDict2, "New Item :1", "this is not a number");
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     ThreadSafeDictionary.AddItem("New Item:1", 1);
     ThreadSafeDictionary.AddItem("New Item:2", 2);
 }