在C#中建立具有指定區分大小寫的空的HybridDictionary
要建立具有指定區分大小寫的空HybridDictionary,以下為程式碼 -
示例
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);
}
}輸出
這將產生以下輸出 -
Key/Value pairs... Key = A, Value = AB Key = B, Value = BC Key = C, Value = DE Key = D, Value = FG Key = e, Value = fg
示例
我們看另一個示例 -
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);
}
}輸出
這將產生以下輸出 -
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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP