N
Nathan Sokalski
I am trying to make a SortedList using the following code:
Dim Poems As New SortedList(47)
Dim poemfiles As String() =
System.IO.Directory.GetFiles(Server.MapPath("poetry/poems/"))
For Each poemfile As String In poemfiles
Poems.Add(System.IO.File.OpenText(poemfile).ReadLine(), poemfile)
Next
My application makes it through all this code fine, and I have tested that
both parameters in the Poems.Add() method are Strings. However, when I try
to access the SortedList I recieve an error about the IComparer. I use the
following expression inside a loop to attempt to access it (j is the loop
control variable):
CStr(CType(Global.Poems(j), DictionaryEntry).Key)
Because I am somewhat unfamiliar with the IComparer class and the help files
didn't seem to be of much help, could someone tell me what I am doing wrong?
Thanks.
Dim Poems As New SortedList(47)
Dim poemfiles As String() =
System.IO.Directory.GetFiles(Server.MapPath("poetry/poems/"))
For Each poemfile As String In poemfiles
Poems.Add(System.IO.File.OpenText(poemfile).ReadLine(), poemfile)
Next
My application makes it through all this code fine, and I have tested that
both parameters in the Poems.Add() method are Strings. However, when I try
to access the SortedList I recieve an error about the IComparer. I use the
following expression inside a loop to attempt to access it (j is the loop
control variable):
CStr(CType(Global.Poems(j), DictionaryEntry).Key)
Because I am somewhat unfamiliar with the IComparer class and the help files
didn't seem to be of much help, could someone tell me what I am doing wrong?
Thanks.