FindFile Class |
Namespace: VirtualRadar.Interop
The FindFile type exposes the following members.
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetFiles |
Returns a list of files in a folder.
| |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Before .NET 4.0 the DirectoryInfo.GetFiles() method would read all of the files in a folder in one go but it would lazily read the attributes, lengths etc. of those files. When reading the names and last modified dates of 7500 files across the network using DirectoryInfo it was taking a minute in 3.5 and a couple of seconds in 4.
I need it to be very fast but I can't justify switching the product over to .Net 4.0 just for that, so instead I've done this wrapper around Win32's FindFirstFile / FindNextFile. When I do move VRS onto .Net 4 I can probably ditch this. Also, if VRS is being ported to some other platform this can probably be reimplemented in C# using a DirectoryInfo.