Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Creating an empty HybridDictionary with specified case sensitivity in C#
To create an empty HybridDictionary with specified case sensitivity, the code is as follows −
Example
using System;
using System.Collections;
using System.Collections.Specialized;
public class Demo {
public static void Main() {
HybridDictionary myDict = new HybridDictionary();
myDict.Add("A", "AB");
myDict.Add("B", "BC");
myDict.Add("C", "DE");
myDict.Add("D", "FG");
myDict.Add("e", "fg");
Console.WriteLine("Key/Value pairs...");
foreach(DictionaryEntry de in myDict)
Console.WriteLine("Key = "+de.Key + ", Value = " + de.Value);
}
}
Output
This will produce the following output −
Key/Value pairs... Key = A, Value = AB Key = B, Value = BC Key = C, Value = DE Key = D, Value = FG Key = e, Value = fg
Example
Let us see another example −
using System;
using System.Collections;
using System.Collections.Specialized;
public class Demo {
public static void Main() {
HybridDictionary myDict = new HybridDictionary();
myDict.Add("A", "PQ");
myDict.Add("B", "BC");
myDict.Add("C", "tu");
myDict.Add("D", "FG");
myDict.Add("d", "gh");
myDict.Add("e", "fg");
Console.WriteLine("Key/Value pairs...");
foreach(DictionaryEntry de in myDict)
Console.WriteLine("Key = "+de.Key + ", Value = " + de.Value);
}
}
Output
This will produce the following output −
Key/Value pairs... Key = A, Value = PQ Key = B, Value = BC Key = C, Value = tu Key = D, Value = FG Key = d, Value = gh Key = e, Value = fg
Advertisements