MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FileAccess Enumeration

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Defines constants for read, write, or read/write access to a file.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

[FlagsAttribute]
public enum FileAccess

Member nameDescription
ReadRead access to the file. Data can be read from the file. Combine with Write for read/write access.
ReadWriteRead and write access to the file. Data can be written to and read from the file.
WriteWrite access to the file. Data can be written to the file. Combine with Read for read/write access.

Specify a FileAccess parameter in IsolatedStorageFileStream constructors.

The following example accesses a file for writing. This code example is part of a larger example provided for the IsolatedStorageFile class.


// Write to an existing file: MyApp1\SubDir1\MyApp1A.txt

// Determine if the file exists before writing to it.
string filePath = Path.Combine(subdirectory1, "MyApp1A.txt");

if (store.FileExists(filePath))
{
    try
    {
        using (StreamWriter sw =
            new StreamWriter(store.OpenFile(filePath,
                FileMode.Open, FileAccess.Write)))
        {
            sw.WriteLine("To do list:");
            sw.WriteLine("1. Buy supplies.");
        }
    }
    catch (IsolatedStorageException ex)
    {

        sb.AppendLine(ex.Message);
    }
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft