Freigeben über


IsolatedStorageFileStream-Konstruktor (String, FileMode, FileAccess, FileShare)

Initialisiert eine neue Instanz einer IsolatedStorageFileStream-Klasse, die im angegebenen mode mit dem angegebenen Datei-access und unter Verwendung des durch share angegebenen Dateifreigabemodus Zugriff auf die durch path angegebene Datei ermöglicht.

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

Syntax

'Declaration
Public Sub New ( _
    path As String, _
    mode As FileMode, _
    access As FileAccess, _
    share As FileShare _
)
'Usage
Dim path As String
Dim mode As FileMode
Dim access As FileAccess
Dim share As FileShare

Dim instance As New IsolatedStorageFileStream(path, mode, access, share)
public IsolatedStorageFileStream (
    string path,
    FileMode mode,
    FileAccess access,
    FileShare share
)
public:
IsolatedStorageFileStream (
    String^ path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share
)
public IsolatedStorageFileStream (
    String path, 
    FileMode mode, 
    FileAccess access, 
    FileShare share
)
public function IsolatedStorageFileStream (
    path : String, 
    mode : FileMode, 
    access : FileAccess, 
    share : FileShare
)

Parameter

  • path
    Der relative Pfad der Datei innerhalb des isolierten Speichers.
  • access
    Eine bitweise Kombination der FileAccess-Werte.
  • share
    Eine bitweise Kombination der FileShare-Werte.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentException

Der path ist nicht wohlgeformt.

ArgumentNullException

path ist NULL (Nothing in Visual Basic).

FileNotFoundException

Es wurde keine Datei gefunden, und mode ist auf Open festgelegt.

Hinweise

Der Gültigkeitsbereich des verwendeten isolierten Speichers wird durch die Identität der derzeit ausgeführten Assembly und der Anwendungsdomäne festgelegt, in der diese ausgeführt wird. Dieser Speicher bleibt nur für die Lebensdauer des IsolatedStorageFileStream-Objekts geöffnet. Um einen anderen Gültigkeitsbereich für die isolierte Speicherung anzugeben oder den Speicher geöffnet zu halten, damit mehrere IsolatedStorageFileStream-Objekte aus diesem geöffnet werden können, verwenden Sie die Form des Konstruktors, bei der ein IsolatedStorageFile-Objekt zulässig ist.

Warnung

Wenn Sie einen Zeichensatz mit einer bestimmten Kultureinstellung kompilieren und die gleichen Zeichen mit einer anderen Kultureinstellung abrufen, können diese möglicherweise nicht interpretiert werden, und es wird eine Ausnahme ausgelöst.

Beispiel

Das folgende Codebeispiel veranschaulicht die Verwendung dieses Konstruktors. Den vollständigen Kontext dieses Beispiels finden Sie in der Übersicht zu IsolatedStorageFileStream.

' Retrieve an IsolatedStorageFile for the current Domain and Assembly.
Dim isoFile As IsolatedStorageFile = _
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User _
    Or IsolatedStorageScope.Assembly _
    Or IsolatedStorageScope.Domain, Nothing, Nothing)

Dim isoStream As New IsolatedStorageFileStream(Me.userName, FileMode.Open, _
    FileAccess.Read, FileShare.Read)
// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile isoFile =
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
    IsolatedStorageScope.Assembly |
    IsolatedStorageScope.Domain,
    null,
    null);

IsolatedStorageFileStream isoStream =
    new IsolatedStorageFileStream(this.userName,
    FileMode.Open,
    FileAccess.Read,
    FileShare.Read);
// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast<IsolatedStorageScope>(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr, nullptr );
IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile );

.NET Framework-Sicherheit

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

IsolatedStorageFileStream-Klasse
IsolatedStorageFileStream-Member
System.IO.IsolatedStorage-Namespace