PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSListFilesInDirectory/ReadMe.txt

#
Plain Text | 43 lines | 30 code | 13 blank | 0 comment | 0 complexity | a06d8d38d2b6def9dc0d781d3d451563 MD5 | raw file
 1========================================================================
 2   WINDOWS FORMS APPLICATION : CSListFilesInDirectory Project Overview
 3========================================================================
 4
 5/////////////////////////////////////////////////////////////////////////////
 6Use:
 7
 8The CSListFilesInDirectory project demonstrates how to implement an 
 9IEnumerable<string> that utilizes the Win32 File Management functions to 
10enable application to get files and sub-directories in a specified directory
11one item a time.
12
13The FileEnumerator class in this sample project solved a common problem in
14the System.IO.Directory.GetFiles method - if a directory contains a large
15number of items, this it will take a long time for this method to return
16because it will enumerate all the files and put the names in an array as
17an entire operation. This will also cause a very high memory load if the
18array gets huge.
19
20The FileEnumerator class works differently. It returns one file at a time.
21And the enumeration can be canceled or reset at anytime.
22
23
24/////////////////////////////////////////////////////////////////////////////
25References:
26
27FindFirstFile Function
28http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx
29
30FindNextFile Function
31http://msdn.microsoft.com/en-us/library/aa364428(VS.85).aspx
32
33FindClose Function
34http://msdn.microsoft.com/en-us/library/aa364413(VS.85).aspx
35
36IEnumerable<T> Interface
37http://msdn.microsoft.com/en-us/library/9eekhta0.aspx
38
39IEnumerator<T> Interface
40http://msdn.microsoft.com/en-us/library/78dfe2yb.aspx
41
42
43/////////////////////////////////////////////////////////////////////////////