Create a SortedList using the CaseInsensitiveComparer based on the Turkish culture (tr-TR)
Imports System
Imports System.Collections
Imports System.Globalization
Public Class SamplesSortedList
Public Shared Sub Main()
Dim myHT As New Hashtable()
myHT.Add("FIRST", "Hello")
myHT.Add("SECOND", "World")
myHT.Add("THIRD", "!")
Dim myCul As New CultureInfo("tr-TR")
Dim mySL3 As New SortedList(myHT, New CaseInsensitiveComparer(myCul))
Try
mySL3.Add("first", "AA")
Catch e As ArgumentException
Console.WriteLine(e)
End Try
PrintKeysAndValues(mySL3)
End Sub 'Main
Public Shared Sub PrintKeysAndValues(ByVal myList As SortedList)
Dim i As Integer
For i = 0 To myList.Count - 1
Console.WriteLine("{0,-6}: {1}", myList.GetKey(i), myList.GetByIndex(i))
Next i
End Sub
End Class
Related examples in the same category