|
|
|
The following code will sort file list based on CreationTime |
Click here to copy the following block | Option Explicit On Option Strict On
Imports System.Collections Imports System.IO
Module Module1
Private Class CreateTimeComparer Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare Return -DateTime.Compare(DirectCast(x, FileInfo).CreationTime, DirectCast(y, FileInfo).CreationTime) End Function End Class
Sub Main() Dim al As New ArrayList Dim files() As String = Directory.GetFiles("c:\windows\system32") Dim comparer As New CreateTimeComparer
For Each file As String In files al.Add(New FileInfo(file)) Next
al.Sort(comparer)
For Each fi As FileInfo In al Console.WriteLine(fi.CreationTime) Console.ReadLine() Next End Sub
End Module |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|