FileShare.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.IO
  5. {
  6. // Contains constants for controlling file sharing options while
  7. // opening files. You can specify what access other processes trying
  8. // to open the same file concurrently can have.
  9. //
  10. // Note these values currently match the values for FILE_SHARE_READ,
  11. // FILE_SHARE_WRITE, and FILE_SHARE_DELETE in winnt.h
  12. //
  13. [Flags]
  14. public enum FileShare
  15. {
  16. // No sharing. Any request to open the file (by this process or another
  17. // process) will fail until the file is closed.
  18. None = 0,
  19. // Allows subsequent opening of the file for reading. If this flag is not
  20. // specified, any request to open the file for reading (by this process or
  21. // another process) will fail until the file is closed.
  22. Read = 1,
  23. // Allows subsequent opening of the file for writing. If this flag is not
  24. // specified, any request to open the file for writing (by this process or
  25. // another process) will fail until the file is closed.
  26. Write = 2,
  27. // Allows subsequent opening of the file for writing or reading. If this flag
  28. // is not specified, any request to open the file for writing or reading (by
  29. // this process or another process) will fail until the file is closed.
  30. ReadWrite = 3,
  31. // Open the file, but allow someone else to delete the file.
  32. Delete = 4,
  33. // Whether the file handle should be inheritable by child processes.
  34. // Note this is not directly supported like this by Win32.
  35. Inheritable = 0x10,
  36. }
  37. }