OpenShare 枚举


指示调用文件访问函数时如何打开文件。Indicates how to open a file when calling file-access functions.

public enum class OpenShare
public enum OpenShare
type OpenShare = 
Public Enum OpenShare


Default -1

LockReadWriteLockReadWrite. 这是默认设置。This is the default.

LockRead 2

其他进程无法读取文件。Other processes cannot read the file.

LockReadWrite 0

其他进程无法读取或写入文件。Other processes cannot read or write to the file.

LockWrite 1

其他进程无法写入文件。Other processes cannot write to the file.

Shared 3

任何进程都可以读取或写入文件。Any process can read or write to the file.


调用文件访问相关的函数时, 可以在代码中使用枚举成员来代替实际值。When you call file access-related functions, you can use enumeration members in your code in place of the actual values.

OpenShare枚举定义一些常量, 这些常量指定在应用程序打开文件时其他进程是否可以访问该文件。The OpenShare enumeration defines constants that specify whether or not other processes can access the file while your application has it open. 下表列出OpenShare了枚举成员。The following table lists the OpenShare enumeration members.

执行文件 i/o 操作时, My.Computer.FileSystem对象可提供比旧的文件 i/o 方法更好的性能和易用性。When performing file I/O operations, the My.Computer.FileSystem object provides greater performance and ease of use than legacy file I/O methods. 有关详细信息, 请FileSystem参阅对象。For more information, see FileSystem object.