PageRenderTime 42ms CodeModel.GetById 10ms RepoModel.GetById 0ms 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. Use:
  6. The CSListFilesInDirectory project demonstrates how to implement an
  7. IEnumerable<string> that utilizes the Win32 File Management functions to
  8. enable application to get files and sub-directories in a specified directory
  9. one item a time.
  10. The FileEnumerator class in this sample project solved a common problem in
  11. the System.IO.Directory.GetFiles method - if a directory contains a large
  12. number of items, this it will take a long time for this method to return
  13. because it will enumerate all the files and put the names in an array as
  14. an entire operation. This will also cause a very high memory load if the
  15. array gets huge.
  16. The FileEnumerator class works differently. It returns one file at a time.
  17. And the enumeration can be canceled or reset at anytime.
  18. /////////////////////////////////////////////////////////////////////////////
  19. References:
  20. FindFirstFile Function
  21. http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx
  22. FindNextFile Function
  23. http://msdn.microsoft.com/en-us/library/aa364428(VS.85).aspx
  24. FindClose Function
  25. http://msdn.microsoft.com/en-us/library/aa364413(VS.85).aspx
  26. IEnumerable<T> Interface
  27. http://msdn.microsoft.com/en-us/library/9eekhta0.aspx
  28. IEnumerator<T> Interface
  29. http://msdn.microsoft.com/en-us/library/78dfe2yb.aspx
  30. /////////////////////////////////////////////////////////////////////////////