在 C# 中,SortedList 类的 Values 属性有何作用?
首先,声明 SortedList 类 -
SortedList list = new SortedList();
现在添加值 -
list.Add("S1", "Wallets");
list.Add("S2", "Sunglasses");
list.Add("S3", "Backpacks");下面是使用 SortedList 类的 Values 属性的代码 -
示例
using System;
using System.Collections;
namespace Demo {
class Program {
static void Main(string[] args) {
SortedList list = new SortedList();
list.Add("S1", "Wallets");
list.Add("S2", "Sunglasses");
list.Add("S3", "Backpacks");
foreach (string value in list.Values) {
Console.WriteLine(value);
}
}
}
}输出
Wallets Sunglasses Backpacks
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP