FileShare.cs 1.8 KB

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