' Collection of code snippets by Arne Vajhøj ' posted to eksperten.dk, usenet and other places (2002-now) Imports System Imports System.Collections Imports System.IO Class TestClass Public Shared Sub Main(ByVal args As String()) Dim di As DirectoryInfo = New DirectoryInfo("C:\") Dim fi As FileInfo() = di.GetFiles Dim i As Integer For i = 0 To (fi.Length - 1) Console.WriteLine(fi(i).Name) Next Array.Sort(fi, New FileInfoComparer) For i = 0 To (fi.Length - 1) Console.WriteLine(fi(i).Name) Next End Sub End Class Public Class FileInfoComparer Implements IComparer Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare Return String.Compare(CType(x, FileInfo).Name, CType(y, FileInfo).Name) End Function End Class