本文整理汇总了VB.NET中System.Collections.Specialized.OrderedDictionary.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:VB.NET OrderedDictionary.GetEnumerator方法的具体用法?VB.NET OrderedDictionary.GetEnumerator怎么用?VB.NET OrderedDictionary.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.OrderedDictionary
的用法示例。
在下文中一共展示了OrderedDictionary.GetEnumerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1:
' Clear the OrderedDictionary and add new values
myOrderedDictionary.Clear()
myOrderedDictionary.Add("newKey1", "newValue1")
myOrderedDictionary.Add("newKey2", "newValue2")
myOrderedDictionary.Add("newKey3", "newValue3")
' Display the contents of the "new" Dictionary Imports an enumerator
Dim myEnumerator As IDictionaryEnumerator = _
myOrderedDictionary.GetEnumerator()
Console.WriteLine( _
"{0}Displaying the entries of a 'new' OrderedDictionary.", _
Environment.NewLine)
DisplayEnumerator(myEnumerator)
示例2: DisplayEnumerator
' Displays the contents of the OrderedDictionary using its enumerator
Public Shared Sub DisplayEnumerator( _
ByVal myEnumerator As IDictionaryEnumerator)
Console.WriteLine(" KEY VALUE")
While myEnumerator.MoveNext()
Console.WriteLine(" {0,-25} {1}", _
myEnumerator.Key, myEnumerator.Value)
End While
End Sub