The Labs \ Source Viewer \ SSCLI \ System.IO \ FileShare

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** Enum:  FileShare
  18. **
  19. **
  20. ** Purpose: Enum describing how to share files with other
  21. ** processes - ie, whether two processes can simultaneously
  22. ** read from the same file.
  23. **
  24. **
  25. ===========================================================*/
  26. using System;
  27. namespace System.IO
  28. {
  29.     // Contains constants for controlling file sharing options while
  30.     // opening files. You can specify what access other processes trying
  31.     // to open the same file concurrently can have.
  32.     //
  33.     // Note these values currently match the values for FILE_SHARE_READ,
  34.     // FILE_SHARE_WRITE, and FILE_SHARE_DELETE in winnt.h
  35.     //
  36.     [Serializable(), Flags()]
  37.     [System.Runtime.InteropServices.ComVisible(true)]
  38.     public enum FileShare
  39.     {
  40.         // No sharing. Any request to open the file (by this process or another
  41.         // process) will fail until the file is closed.
  42.         None = 0,
  43.        
  44.         // Allows subsequent opening of the file for reading. If this flag is not
  45.         // specified, any request to open the file for reading (by this process or
  46.         // another process) will fail until the file is closed.
  47.         Read = 1,
  48.        
  49.         // Allows subsequent opening of the file for writing. If this flag is not
  50.         // specified, any request to open the file for writing (by this process or
  51.         // another process) will fail until the file is closed.
  52.         Write = 2,
  53.        
  54.         // Allows subsequent opening of the file for writing or reading. If this flag
  55.         // is not specified, any request to open the file for writing or reading (by
  56.         // this process or another process) will fail until the file is closed.
  57.         ReadWrite = 3,
  58.        
  59.         // Open the file, but allow someone else to delete the file.
  60.         Delete = 4,
  61.        
  62.         // Whether the file handle should be inheritable by child processes.
  63.         // Note this is not directly supported like this by Win32.
  64.         Inheritable = 16
  65.     }
  66. }

Developer Fusion