VB.Net Tutorial/Collections/CollectionsUtil — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:53, 26 мая 2010
CollectionsUtil.CreateCaseInsensitiveSortedList
Imports System.Collections.Specialized
Imports System.Collections
public class Test
public Shared Sub Main
Dim sorted_list As SortedList
" Use a normal, case-sensitive SortedList.
sorted_list = New SortedList
sorted_list.Add("Sport", "Volleyball")
sorted_list.Add("sport", "Golf") " Okay because Sport <> sport.
" Use a case-insensitive SortedList.
sorted_list = CollectionsUtil.CreateCaseInsensitiveSortedList()
sorted_list.Add("Sport", "Volleyball")
sorted_list.Add("sport", "Golf") " Error because Sport = sport.
End Sub
End class
Unhandled Exception: System.ArgumentException: Item has already been added. Key in dictionary: "Spor t" Key being added: "sport" at System.Collections.SortedList.Add(Object key, Object value) at Test.Main()