找到 34423 篇文章 关于编程

获取 C# 中 SortedList 对象中指定键的索引

AmitDiwan
更新于 2019-12-05 13:13:21

220 次浏览

要获取 SortedList 对象中指定键的索引,代码如下:示例 在线演示使用 System;使用 System.Collections;公共类演示 {    公共静态无效 Main(字符串[] args) {       SortedList 列表 = 新 SortedList();       列表.Add("One", "Finance");       列表.Add("Two", "Marketing");       列表.Add("Three", "Sales");       列表.Add("Four", "Purchase");       列表.Add("Five", "Operations");       列表.Add("Six", "IT");       Console.WriteLine("SortedList 元素...");       针对每个(字典条目 d 在列表中) {          Console.WriteLine(d.Key + " " + d.Value);       }       ... 阅读更多

获取 C# 中 SortedList 对象中指定值的索引

AmitDiwan
更新于 2019-12-05 13:09:37

55 次浏览

要获取 SortedList 对象中指定值的索引,代码如下:示例 在线演示使用 System;使用 System.Collections;公共类演示 {    公共静态无效 Main(字符串[] args) {       SortedList list1 = 新 SortedList();       list1.Add("One", 1);       list1.Add("Two ", 2);       list1.Add("Three ", 3);       list1.Add("Four", 4);       list1.Add("Five", 5);       list1.Add("Six", 6);       list1.Add("Seven ", 7);       list1.Add("Eight ", 8);       list1.Add("Nine", 9);       list1.Add("Ten", 10);       Console.WriteLine("SortedList1 元素...");   ... 阅读更多

从 C# 中的 HybridDictionary 中删除指定键的条目

AmitDiwan
更新于 2019-12-05 13:05:42

82 次浏览

要从 HybridDcitionary 中删除指定键的条目,代码如下:示例 在线演示使用 System;使用 System.Collections;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main() {       HybridDictionary dict1 = 新 HybridDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       dict1.Add("C", "Smart Wearables");       dict1.Add("D", "Pet Supplies");       dict1.Add("E", "Clothing");       dict1.Add("F", "Footwear");       Console.WriteLine("HybridDictionary1 元素...");       针对每个(字典条目 d 在 dict1 中) {          Console.WriteLine(d.Key + " " + d.Value);       }       ... 阅读更多

从 C# 中的 StringCollection 中删除第一次出现的元素

AmitDiwan
更新于 2019-12-05 13:00:00

76 次浏览

要从 StringCollection 中删除第一次出现的元素,代码如下:示例 在线演示使用 System;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main() {       StringCollection stringCol = 新 StringCollection();       字符串[] arr = 新字符串[] { "100", "200", "100", "400", "500" };       Console.WriteLine("数组元素...");       针对每个(字符串 res 在 arr 中) {          Console.WriteLine(res);       }       stringCol.AddRange(arr);       Console.WriteLine("元素总数 = " + stringCol.Count);       stringCol.Remove("100");       Console.WriteLine("现在元素总数 = ... 阅读更多

检查 C# 中的 StringCollection 是否为只读

AmitDiwan
更新于 2019-12-05 12:55:55

70 次浏览

要检查 StringCollection 是否为只读,代码如下:示例 在线演示使用 System;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main() {       StringCollection stringCol = 新 StringCollection();       字符串[] arr = 新字符串[] { "100", "200", "300", "400", "500" };       Console.WriteLine("数组元素...");       针对每个(字符串 res 在 arr 中) {          Console.WriteLine(res);       }       stringCol.AddRange(arr);       Console.WriteLine("StringCollection 是否为只读? = " + stringCol.IsReadOnly);       Console.WriteLine("指定的字符串是否在 StringCollection 中? = " + stringCol.Contains("800"));   ... 阅读更多

检查 C# 中的 StringCollection 中是否存在指定的字符串

AmitDiwan
更新于 2019-12-05 12:52:23

70 次浏览

要检查 StringCollection 中是否存在指定的字符串,代码如下:示例 在线演示使用 System;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main() {       StringCollection stringCol = 新 StringCollection();       字符串[] arr = 新字符串[] { "100", "200", "300", "400", "500" };       Console.WriteLine("数组元素...");       针对每个(字符串 res 在 arr 中) {          Console.WriteLine(res);       }       stringCol.AddRange(arr);       Console.WriteLine("指定的字符串是否在 StringCollection 中? = " + stringCol.Contains("800"));    } }输出这将产生以下 ... 阅读更多

从 C# 中的 ListDictionary 中删除具有指定键的条目

AmitDiwan
更新于 2019-12-05 12:48:41

61 次浏览

要从 ListDictionary 中删除具有指定键的条目,代码如下:示例 在线演示使用 System;使用 System.Collections;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main(){       ListDictionary dict1 = 新 ListDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       dict1.Add("C", "Smart Wearables");       dict1.Add("D", "Pet Supplies");       dict1.Add("E", "Clothing");       dict1.Add("F", "Footwear");       Console.WriteLine("ListDictionary1 元素...");       针对每个(字典条目 d 在 dict1 中) {          Console.WriteLine(d.Key + " " + d.Value);       }       ... 阅读更多

从 C# 中的 OrderedDictionary 中删除指定索引处的条目

AmitDiwan
更新于 2019-12-05 12:43:34

67 次浏览

要从 OrdererdDictionary 中删除指定索引处的条目,代码如下:示例 在线演示使用 System;使用 System.Collections;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main() {       OrderedDictionary dict = 新 OrderedDictionary();       dict.Add("A", "Books");       dict.Add("B", "Electronics");       dict.Add("C", "Smart Wearables");       dict.Add("D", "Pet Supplies");       dict.Add("E", "Clothing");       dict.Add("F", "Footwear");       Console.WriteLine("OrderedDictionary 元素...");       针对每个(字典条目 d 在 dict 中) {          Console.WriteLine(d.Key + " " + d.Value);       }     ... 阅读更多

检查 C# 中的两个 SortedList 对象是否相等

AmitDiwan
更新于 2019-12-05 12:39:56

74 次浏览

要检查两个 SortedList 对象是否相等,代码如下:示例 在线演示使用 System;使用 System.Collections;公共类演示 {    公共静态无效 Main(字符串[] args) {       SortedList list1 = 新 SortedList();       list1.Add("One", 1);       list1.Add("Two ", 2);       list1.Add("Three ", 3);       list1.Add("Four", 4);       list1.Add("Five", 5);       list1.Add("Six", 6);       list1.Add("Seven ", 7);       list1.Add("Eight ", 8);       list1.Add("Nine", 9);       list1.Add("Ten", 10);       Console.WriteLine("SortedList1 元素...");       针对每个(字典条目 ... 阅读更多

检查 C# 中的两个 OrderedDictionary 对象是否相等

AmitDiwan
更新于 2019-12-05 12:34:02

78 次浏览

要检查两个 OrderedDictionary 对象是否相等,代码如下:示例 在线演示使用 System;使用 System.Collections;使用 System.Collections.Specialized;公共类演示 {    公共静态无效 Main() {       OrderedDictionary dict1 = 新 OrderedDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       dict1.Add("C", "Smart Wearables");       dict1.Add("D", "Pet Supplies");       dict1.Add("E", "Clothing");       dict1.Add("F", "Footwear");       Console.WriteLine("OrderedDictionary1 元素...");       针对每个(字典条目 d 在 dict1 中) {          Console.WriteLine(d.Key + " " + d.Value);       }       ... 阅读更多

广告
© . All rights reserved.