IsolatedStorageFileStream Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy IsolatedStorageFileStream. Jedynym sposobem otwarcia obiektu IsolatedStorageFileStream jest użycie jednego z jego konstruktorów.

Przeciążenia

IsolatedStorageFileStream(String, FileMode)

Inicjuje nowe wystąpienie IsolatedStorageFileStream obiektu dające dostęp do pliku wyznaczonego przez path w określonym modeobiekcie .

IsolatedStorageFileStream(String, FileMode, FileAccess)

Inicjuje IsolatedStorageFileStream nowe wystąpienie klasy dające dostęp do pliku wyznaczonego przez path, w określonym modeobiekcie , z typem żądanego access .

IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)

Inicjuje IsolatedStorageFileStream nowe wystąpienie klasy dające dostęp do pliku wyznaczonego przez path, w określonym modeobiekcie i w kontekście określonego IsolatedStorageFile przez isf.

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez pathprogram w określonym pliku z określonym modeplikiem accessprzy użyciu trybu udostępniania plików określonego przez share.

IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez path w określonym pliku , z określonym modeplikiem accessi w kontekście określonego IsolatedStorageFile przez isf.

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32)

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez path, w określonym pliku z określonym modeplikiem access, przy użyciu trybu udostępniania plików określonego przez share, z buffersize określonym.

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile)

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez path, w określonym pliku z określonym modeplikiem access, przy użyciu trybu udostępniania plików określonego przez share, i w kontekście określonego IsolatedStorageFile przez isf.

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32, IsolatedStorageFile)

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez path, w określonym pliku , z określonym modeplikiem access, przy użyciu trybu udostępniania plików określonego przez share, z buffersize określonym i w kontekście IsolatedStorageFile określonym przez isf.

IsolatedStorageFileStream(String, FileMode)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje nowe wystąpienie IsolatedStorageFileStream obiektu dające dostęp do pliku wyznaczonego przez path w określonym modeobiekcie .

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

FileMode Jedna z wartości.

Wyjątki

Jest path źle sformułowany.

Wartość path to null.

Katalog w programie path nie istnieje.

Nie znaleziono pliku i ustawiono mode parametr na Open

Uwagi

Izolowany magazyn, który jest używany, jest w zakresie przez bieżącą tożsamość zestawu i domenę aplikacji, w której jest uruchomiona. Ten magazyn pozostanie otwarty tylko przez okres istnienia IsolatedStorageFileStream obiektu. Aby określić inny izolowany zakres magazynu lub zezwolić magazynowi na pozostanie otwartym (aby można było otworzyć z niego wiele IsolatedStorageFileStream obiektów), użyj formularza konstruktora, który akceptuje IsolatedStorageFile obiekt.

Parametr mode wskazuje, czy należy utworzyć nowy plik, istniejący używany itd.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, FileAccess)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje IsolatedStorageFileStream nowe wystąpienie klasy dające dostęp do pliku wyznaczonego przez path, w określonym modeobiekcie , z typem żądanego access .

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

FileMode Jedna z wartości.

access
FileAccess

Bitowa kombinacja FileAccess wartości.

Wyjątki

Jest path źle sformułowany.

Wartość path to null.

Nie znaleziono pliku i mode parametr jest ustawiony na Openwartość .

Uwagi

Izolowany magazyn, który jest używany, jest w zakresie przez bieżącą tożsamość zestawu i domenę aplikacji, w której jest uruchomiona. Ten magazyn pozostanie otwarty tylko przez okres istnienia IsolatedStorageFileStream obiektu. Aby określić inny izolowany zakres magazynu lub zezwolić magazynowi na pozostanie otwartym (aby można było otworzyć z niego wiele IsolatedStorageFileStream obiektów), użyj formularza konstruktora, który akceptuje IsolatedStorageFile obiekt.

Parametr mode wskazuje, czy należy utworzyć nowy plik, czy istniejący. Parametr access zawiera tylko do odczytu, odczytu/zapisu i tylko do zapisu.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje IsolatedStorageFileStream nowe wystąpienie klasy dające dostęp do pliku wyznaczonego przez path, w określonym modeobiekcie i w kontekście określonego IsolatedStorageFile przez isf.

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, isf As IsolatedStorageFile)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

FileMode Jedna z wartości.

isf
IsolatedStorageFile

Element IsolatedStorageFile , w którym ma być otwarty element IsolatedStorageFileStream.

Wyjątki

Jest path źle sformułowany.

Wartość path to null.

Nie znaleziono pliku i mode parametr jest ustawiony na Openwartość .

isf nie ma limitu przydziału.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego konstruktora. Pełny kontekst tego przykładu IsolatedStorageFileStream zawiera omówienie.

// This is the stream to which data will be written.
IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile );

// This is the stream from which data will be read.
Console::WriteLine( "Is the source file readable?  {0}", (source->CanRead ? (String^)"true" : "false") );
Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." );

// Open or create a writable file.
IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile );

IsolatedStorageFileStream source =
    new IsolatedStorageFileStream(this.userName, FileMode.OpenOrCreate,
    isoFile);
// This is the stream from which data will be read.
Console.WriteLine("Is the source file readable? " + (source.CanRead ? "true" : "false"));
Console.WriteLine("Creating new IsolatedStorageFileStream for Archive.");

// Open or create a writable file.
IsolatedStorageFileStream target =
    new IsolatedStorageFileStream("Archive\\ " + this.userName,
    FileMode.OpenOrCreate,
    FileAccess.Write,
    FileShare.Write,
    isoFile);
' Open or create a writable file.
Dim target As New IsolatedStorageFileStream("Archive\ " & Me.userName, _
     FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, isoFile)

Uwagi

Parametr mode wskazuje, czy należy utworzyć nowy plik, istniejący używany itd.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez pathprogram w określonym pliku z określonym modeplikiem accessprzy użyciu trybu udostępniania plików określonego przez share.

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

FileMode Jedna z wartości.

access
FileAccess

Bitowa kombinacja FileAccess wartości.

share
FileShare

Bitowa kombinacja FileShare wartości.

Wyjątki

Jest path źle sformułowany.

Wartość path to null.

Nie znaleziono pliku i mode parametr jest ustawiony na Openwartość .

Przykłady

W poniższym przykładzie kodu pokazano użycie tego konstruktora. Pełny kontekst tego przykładu IsolatedStorageFileStream zawiera omówienie.

// 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 );

// 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("substituteUsername",
    System.IO.FileMode.Open,
    System.IO.FileAccess.Read,
     System.IO.FileShare.Read);
' 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("substituteUsername", System.IO.FileMode.Open, _
    System.IO.FileAccess.Read, System.IO.FileShare.Read)

Uwagi

Izolowany magazyn, który jest używany, jest w zakresie przez bieżącą tożsamość zestawu i domenę aplikacji, w której jest uruchomiona. Ten magazyn pozostanie otwarty tylko przez okres istnienia IsolatedStorageFileStream obiektu. Aby określić inny izolowany zakres magazynu lub zezwolić magazynowi na pozostanie otwartym (aby można było otworzyć z niego wiele IsolatedStorageFileStream obiektów), użyj formularza konstruktora, który akceptuje IsolatedStorageFile obiekt.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez path w określonym pliku , z określonym modeplikiem accessi w kontekście określonego IsolatedStorageFile przez isf.

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.IsolatedStorage.IsolatedStorageFile isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, isf As IsolatedStorageFile)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

FileMode Jedna z wartości.

access
FileAccess

Bitowa kombinacja FileAccess wartości.

isf
IsolatedStorageFile

Element IsolatedStorageFile , w którym ma być otwarty element IsolatedStorageFileStream.

Wyjątki

Jest path źle sformułowany.

Wartość path to null.

Wydzielony magazyn jest zamknięty.

Nie znaleziono pliku i mode parametr jest ustawiony na Openwartość .

isf nie ma limitu przydziału.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego konstruktora. Pełny kontekst tego przykładu IsolatedStorageFileStream zawiera omówienie.

IsolatedStorageFile^ isoFile;
isoFile = IsolatedStorageFile::GetUserStoreForDomain();

// Open or create a writable file.
IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,isoFile );
StreamWriter^ writer = gcnew StreamWriter( isoStream );
writer->WriteLine( this->NewsUrl );
writer->WriteLine( this->SportsUrl );

// Calculate the amount of space used to record the user's preferences.
double d = isoFile->CurrentSize / isoFile->MaximumSize;
Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() );
Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() );
writer->Close();
isoFile->Close();
isoStream->Close();
return d;
IsolatedStorageFile isoFile;
isoFile = IsolatedStorageFile.GetUserStoreForDomain();

// Open or create a writable file.
IsolatedStorageFileStream isoStream =
    new IsolatedStorageFileStream(this.userName,
    FileMode.OpenOrCreate,
    FileAccess.Write,
    isoFile);

StreamWriter writer = new StreamWriter(isoStream);
writer.WriteLine(this.NewsUrl);
writer.WriteLine(this.SportsUrl);
// Calculate the amount of space used to record the user's preferences.
double d = isoFile.CurrentSize / isoFile.MaximumSize;
Console.WriteLine("CurrentSize = " + isoFile.CurrentSize.ToString());
Console.WriteLine("MaximumSize = " + isoFile.MaximumSize.ToString());
// StreamWriter.Close implicitly closes isoStream.
writer.Close();
isoFile.Dispose();
isoFile.Close();
return d;
Dim isoFile As IsolatedStorageFile
isoFile = IsolatedStorageFile.GetUserStoreForDomain()

' Open or create a writable file.
Dim isoStream As New IsolatedStorageFileStream(Me.userName, FileMode.OpenOrCreate, _
    FileAccess.Write, isoFile)

Dim writer As New StreamWriter(isoStream)
writer.WriteLine(Me.NewsUrl)
writer.WriteLine(Me.SportsUrl)
' Calculate the amount of space used to record the user's preferences.
Dim d As Double = Convert.ToDouble(isoFile.CurrentSize) / Convert.ToDouble(isoFile.MaximumSize)
Console.WriteLine(("CurrentSize = " & isoFile.CurrentSize.ToString()))
Console.WriteLine(("MaximumSize = " & isoFile.MaximumSize.ToString()))
' StreamWriter.Close implicitly closes isoStream.
writer.Close()
isoFile.Dispose()
isoFile.Close()
Return d

Uwagi

Parametr mode wskazuje, czy należy utworzyć nowy plik, czy istniejący. Parametr access zawiera tylko do odczytu, odczytu/zapisu i tylko do zapisu.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez pathelement , w określonym modepliku , z określonym plikiem access, przy użyciu trybu udostępniania plików określonego przez share, z buffersize określonym.

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, int bufferSize);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * int -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Integer)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

Jedna z FileMode wartości.

access
FileAccess

Bitowa kombinacja FileAccess wartości.

share
FileShare

Bitowa kombinacja FileShare wartości.

bufferSize
Int32

Rozmiar buforu FileStream .

Wyjątki

Jest path źle sformułowany.

Wartość path to null.

Nie znaleziono pliku i mode ustawiono wartość Open.

Uwagi

Izolowany magazyn, który jest używany, ma zakres przez bieżącą tożsamość zestawu i domenę aplikacji, w której jest uruchomiona. Ten magazyn pozostanie otwarty tylko przez cały okres istnienia IsolatedStorageFileStream obiektu. Aby określić inny izolowany zakres magazynu lub zezwolić magazynowi na pozostanie otwartym (aby można było z niego otworzyć wiele IsolatedStorageFileStream obiektów), użyj formularza konstruktora, który akceptuje IsolatedStorageFile obiekt.

Parametr mode wskazuje, czy nowy plik powinien zostać utworzony, czy istniejący. Parametr access zawiera tylko do odczytu, odczytu/zapisu i tylko do zapisu.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy, które zapewnia dostęp do pliku wyznaczonego przez pathelement w określonym modepliku , z określonym plikiem access, przy użyciu trybu udostępniania plików określonego przez , i w kontekście określonego IsolatedStorageFile przez shareisf.

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.IO.IsolatedStorage.IsolatedStorageFile isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, isf As IsolatedStorageFile)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

Jedna z FileMode wartości.

access
FileAccess

Bitowa kombinacja FileAccess wartości.

share
FileShare

Bitowa kombinacja FileShare wartości.

isf
IsolatedStorageFile

Element IsolatedStorageFile , w którym ma być otwarty element IsolatedStorageFileStream.

Wyjątki

Jest path źle sformułowany.

Element path to null.

Nie znaleziono pliku i mode ustawiono wartość Open.

isf nie ma limitu przydziału.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego konstruktora. Pełny kontekst tego przykładu zawiera omówienie IsolatedStorageFileStream .

// This is the stream to which data will be written.
IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile );

// This is the stream from which data will be read.
Console::WriteLine( "Is the source file readable?  {0}", (source->CanRead ? (String^)"true" : "false") );
Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." );

// Open or create a writable file.
IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile );

IsolatedStorageFileStream source =
    new IsolatedStorageFileStream(this.userName, FileMode.OpenOrCreate,
    isoFile);
// This is the stream from which data will be read.
Console.WriteLine("Is the source file readable? " + (source.CanRead ? "true" : "false"));
Console.WriteLine("Creating new IsolatedStorageFileStream for Archive.");

// Open or create a writable file.
IsolatedStorageFileStream target =
    new IsolatedStorageFileStream("Archive\\ " + this.userName,
    FileMode.OpenOrCreate,
    FileAccess.Write,
    FileShare.Write,
    isoFile);
' Open or create a writable file.
Dim target As New IsolatedStorageFileStream("Archive\ " & Me.userName, _
     FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, isoFile)

Uwagi

Parametr mode wskazuje, czy nowy plik powinien zostać utworzony, czy istniejący. Parametr access zawiera tylko do odczytu, odczytu/zapisu i tylko do zapisu.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32, IsolatedStorageFile)

Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs
Źródło:
IsolatedStorageFileStream.cs

Inicjuje nowe wystąpienie IsolatedStorageFileStream klasy dające dostęp do pliku wyznaczonego przez path, w określonym modepliku , z określonym plikiem access, przy użyciu trybu udostępniania plików określonego przez , z buffersize określonym i w kontekście IsolatedStorageFile określonym przez shareisf.

public:
 IsolatedStorageFileStream(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share, int bufferSize, System::IO::IsolatedStorage::IsolatedStorageFile ^ isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile? isf);
public IsolatedStorageFileStream (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.IsolatedStorage.IsolatedStorageFile isf);
new System.IO.IsolatedStorage.IsolatedStorageFileStream : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare * int * System.IO.IsolatedStorage.IsolatedStorageFile -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Sub New (path As String, mode As FileMode, access As FileAccess, share As FileShare, bufferSize As Integer, isf As IsolatedStorageFile)

Parametry

path
String

Ścieżka względna pliku w izolowanym magazynie.

mode
FileMode

Jedna z FileMode wartości.

access
FileAccess

Bitowa kombinacja FileAccess wartości.

share
FileShare

Bitowa kombinacja FileShare wartości.

bufferSize
Int32

Rozmiar buforu FileStream .

isf
IsolatedStorageFile

Element IsolatedStorageFile , w którym ma być otwarty element IsolatedStorageFileStream.

Wyjątki

Jest path źle sformułowany.

Element path to null.

Nie znaleziono pliku i mode ustawiono wartość Open.

isf nie ma limitu przydziału.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego konstruktora. Pełny kontekst tego przykładu zawiera omówienie IsolatedStorageFileStream .

// Open or create a writable file, no larger than 10k
IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,10240,isoFile );

// Open or create a writable file with a maximum size of 10K.
IsolatedStorageFileStream isoStream =
    new IsolatedStorageFileStream(this.userName,
    FileMode.OpenOrCreate,
    FileAccess.Write,
    FileShare.Write,
    10240,
    isoFile);
' Open or create a writable file with a maximum size of 10K.
Dim isoStream As New IsolatedStorageFileStream(Me.userName, FileMode.OpenOrCreate, _
    FileAccess.Write, FileShare.Write, 10240, isoFile)

Uwagi

Parametr mode wskazuje, czy nowy plik powinien zostać utworzony, czy istniejący. Parametr access zawiera tylko do odczytu, odczytu/zapisu i tylko do zapisu.

Przestroga

Podczas kompilowania zestawu znaków z określonym ustawieniem kulturowym i pobierania tych samych znaków z innym ustawieniem kulturowym znaki mogą nie być interpretowane i mogą powodować zgłoszenie wyjątku.

Dotyczy