Skip to main content

Posts

Showing posts from June, 2019

C# Dictionary

> In this post, we will see how to use a dictionary in C#. > A dictionary in C# is used to store collection of values with key values as pair. > So whenever user wants to get the value then he will have to pass the key value to the dictionary and it will return the value to the user. > The namespace of the C# dictionary is System.Collections.Generic. > Let’s take a simple example of storing digits from 0 to 9 as key value and these digits in the word form as the collection values. > Here, the user will type a digit from 0 to 9 and on clicking the button, it gives the digit in the word form. > To keep this example simple, here the dictionary will be having digits from 0 to 9 only and if user enters a value less than 0 or greater than 9 then he will get the appropriate message. > Following is the code for demonstrating the use of the Dictionary : HTML Code: <body>    <form id="form1" runat="server">        <