• Home
  • Services
  • Writing Services
  • Join Joomla Club
  • Products
  • Request Quote
  • Blog
  • About Us
  • Contact Us
Sep

07

Use of Dictionary in C#

Filed Under (Uncategorized) by Ramin on 07-09-2009

“Dictionary”, the name proves the way of it works. In array we save data one after another and while accessing them we need to put the index and get the appropriate data. In dictionary data is saved with a key value. Dictionary accepts data with a key and while getting data from dictionary the key is provided and the data is fetched.

Example: Suppose 10 employees are there. However the employee will be selected and instantly his/her city is to be displayed. In dictionary we will set ID of the employee as key and the city of the employee as value like following:

Dictionary<int, string> dicEmp = new Dictionary<int, string>();
dicEmp.Add(1, “Kolkata”);
dicEmp.Add(2, “Mumbai”);
dicEmp.Add(4, “Bangalore”);
dicEmp.Add(5, “Delhi”);

In this way the values are saved into dictionary. Please mind before using dictionary “System.Collection.Generic” namespace should be added.

Now how to get data from dictionary?

Suppose the user selects employee whose id is 2 which is set into suppose variable empid.

label1.text = dicEmp[empid];

That is how dictionary is utilized.

0 Comments
Read More

Post a comment

  • Category

    • CMS (4)
    • Dot Net (4)
    • Joomla (3)
    • osCommerce (1)
    • Smarty (1)
    • Uncategorized (2)
    • Website design (1)
  • Services

    • Joomla Web Design and Development
    • Affordable Web Site Design
    • Joomla E-Commerce Websites
    • Custom Software Development
    • Shopping Cart Websites
    • Business Websites
    • Joomla Maintenance and Updates
    • Joomla Sites Redesign
    • PHP Web Development
    • .Net Development
    • Database Programming
    • Professional Joomla Templates
    • PSD to Joomla Template Conversion
    • Joomla Template Customization
    • Wordpress Template Customization
    • Hire Professional Joomla Developer
    • Hire PHP and MySql Developer
    • Hire Dedicated .Net Developer
    • Hire Database Designer
    • Wordpress Blog Design and Development
    • Create Shopping Cart by osCommerce
    • SQL Server2005 Reporting Service

    Writing Services

    • Website Content Writing and Editing
    • Keyword Articles
    • Sales Copy Writer
    • Hire a Blogger
    • Writing a Blog

    Our Products

    • Club Joomla Templates
    • Popular Joomla Extensions
    • Selling Freelancer Site Script
    • Free Joomla Templates
    • Free Joomla Extensions
    • Free Club Joomla Templates
    • Free Club Joomla Extensions

    Our Joomla Book Shop

    • Joomla Template Design
    • Building Websites with Joomla 1.5
    • Begining Ajax with PHP
    • Web Development, Asp.net Ajax
    • osCommerce: Professional Edition
    • Pro Drupal Development
    • Packt.Publishing.Drupal.5.Themes.Dec
    • Smarty PHP Template Programming
    • Wrox.Beginning.JavaScript.3rd.Edition.May
  • Archives

    • September 2009
    • July 2009
    • June 2009
    • May 2009
Joomla Web Design & Development | Shopping Cart Websites | Business Websites
© All Rights Reserved. Joomla Site 4ME