File2.Open Async(FileAccessMode, StorageOpenOptions) Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Opens a random-access stream over the file.
public: IAsyncOperation<IRandomAccessStream ^> ^ OpenAsync(FileAccessMode accessMode, StorageOpenOptions options);
/// [Windows.Foundation.Metadata.Overload("OpenWithOptionsAsync")] /// [Windows.Foundation.Metadata.RemoteAsync] IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode const& accessMode, StorageOpenOptions const& options);
[Windows.Foundation.Metadata.Overload("OpenWithOptionsAsync")] [Windows.Foundation.Metadata.RemoteAsync] public IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode accessMode, StorageOpenOptions options);
function openAsync(accessMode, options)
Public Function OpenAsync (accessMode As FileAccessMode, options As StorageOpenOptions) As IAsyncOperation(Of IRandomAccessStream)
One of the enumeration values that specifies the type of access to allow.
A bitwise combination of the enumeration values that specify options for opening the stream.
When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream.
Using this method, a file can be accessed by both file readers and writers simultaneously. The following is a table describing the situations for various parameter settings of FileAccessMode and StorageOpenOptions:
|None||A reader which is lower priority than a writer. If a write occurs, this low priority reader will fail.||This is a single writer. The file cannot be opened if OpenAsync(Read, AllowOnlyReaders) has been used, and it will prevent a new OpenAsync(Read, AllowOnlyReaders) from being used.|
|AllowOnlyReaders||A reader which can only exist with other readers. If an open is attempted with a writer, it will fail.||This is a single writer. The file cannot be opened if OpenAsync(Read, AllowOnlyReaders) has been used, and it will prevent a new OpenAsync(Read, AllowOnlyReaders) from being used.|
|AllowReadersAndWriters||A reader which can exist with other readers and writers simultaneously.||This writer will invalidate low priority readers when a write occurs and can coexist with other readers and writers.|