本文整理汇总了VB.NET中System.Collections.SortedList.GetValueList方法的典型用法代码示例。如果您正苦于以下问题:VB.NET SortedList.GetValueList方法的具体用法?VB.NET SortedList.GetValueList怎么用?VB.NET SortedList.GetValueList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.SortedList 的用法示例。
在下文中一共展示了SortedList.GetValueList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: SamplesSortedList
' 导入命名空间
Imports System.Collections
Public Class SamplesSortedList
Public Shared Sub Main()
' Creates and initializes a new SortedList.
Dim mySL As New SortedList()
mySL.Add(1.3, "fox")
mySL.Add(1.4, "jumps")
mySL.Add(1.5, "over")
mySL.Add(1.2, "brown")
mySL.Add(1.1, "quick")
mySL.Add(1.0, "The")
mySL.Add(1.6, "the")
mySL.Add(1.8, "dog")
mySL.Add(1.7, "lazy")
' Gets the key and the value based on the index.
Dim myIndex As Integer = 3
Console.WriteLine("The key at index {0} is {1}.", myIndex, _
mySL.GetKey(myIndex))
Console.WriteLine("The value at index {0} is {1}.", myIndex, _
mySL.GetByIndex(myIndex))
' Gets the list of keys and the list of values.
Dim myKeyList As IList = mySL.GetKeyList()
Dim myValueList As IList = mySL.GetValueList()
' Prints the keys in the first column and the values in the second column.
Console.WriteLine(ControlChars.Tab & "-KEY-" & ControlChars.Tab & _
"-VALUE-")
Dim i As Integer
For i = 0 To mySL.Count - 1
Console.WriteLine(ControlChars.Tab & "{0}" & ControlChars.Tab & _
"{1}", myKeyList(i), myValueList(i))
Next i
End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Collections,代码行数:40,代码来源:SortedList.GetValueList 输出:
The key at index 3 is 1.3.
The value at index 3 is fox.
-KEY- -VALUE-
1 The
1.1 quick
1.2 brown
1.3 fox
1.4 jumps
1.5 over
1.6 the
1.7 lazy
1.8 dog
注:本文中的System.Collections.SortedList.GetValueList方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论