IsolatedStorageFileStream Konstruktor
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menginisialisasi instans baru kelas IsolatedStorageFileStream. Satu-satunya cara untuk membuka IsolatedStorageFileStream adalah dengan menggunakan salah satu konstruktornya.
Overload
IsolatedStorageFileStream(String, FileMode) |
Menginisialisasi instans baru objek yang IsolatedStorageFileStream memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, FileAccess) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32, IsolatedStorageFile) |
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh |
IsolatedStorageFileStream(String, FileMode)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans baru objek yang IsolatedStorageFileStream memberikan akses ke file yang ditunjuk oleh path
dalam .mode
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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Direktori di path
tidak ada.
Tidak ada file yang ditemukan dan mode
diatur ke Open
Keterangan
Penyimpanan terisolasi yang digunakan dicakup oleh identitas assembly yang dijalankan saat ini dan domain aplikasi tempatnya berjalan. Penyimpanan ini akan tetap terbuka hanya selama masa IsolatedStorageFileStream pakai objek. Untuk menentukan cakupan penyimpanan terisolasi yang berbeda, atau untuk memungkinkan penyimpanan tetap terbuka (sehingga beberapa IsolatedStorageFileStream objek dapat dibuka darinya), gunakan bentuk konstruktor yang menerima IsolatedStorageFile objek.
Parameter mode
menunjukkan apakah file baru harus dibuat, yang sudah ada yang digunakan, dan sebagainya.
Perhatian
Ketika Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, FileAccess)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh path
, dalam , yang ditentukan mode
, dengan jenis access
yang diminta.
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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
- access
- FileAccess
Kombinasi bitwise dari FileAccess nilai.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
Keterangan
Penyimpanan terisolasi yang digunakan dicakup oleh identitas assembly yang dijalankan saat ini dan domain aplikasi tempatnya berjalan. Penyimpanan ini akan tetap terbuka hanya selama masa IsolatedStorageFileStream pakai objek. Untuk menentukan cakupan penyimpanan terisolasi yang berbeda, atau untuk memungkinkan penyimpanan tetap terbuka (sehingga beberapa IsolatedStorageFileStream objek dapat dibuka darinya), gunakan bentuk konstruktor yang menerima IsolatedStorageFile objek.
Parameter mode
menunjukkan apakah file baru harus dibuat atau yang sudah ada yang digunakan. Parameter ini access
mencakup baca-saja, baca/tulis, dan tulis-saja.
Perhatian
Ketika Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan, dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh path
, dalam mode
, dan dalam konteks IsolatedStorageFile yang ditentukan oleh 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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
untuk IsolatedStorageFile membuka IsolatedStorageFileStream.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
isf
tidak memiliki kuota.
Contoh
Contoh kode berikut menunjukkan penggunaan konstruktor ini. Untuk konteks lengkap contoh ini, lihat IsolatedStorageFileStream gambaran umum.
// 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)
Keterangan
Parameter mode
menunjukkan apakah file baru harus dibuat, yang sudah ada yang digunakan, dan sebagainya.
Perhatian
Ketika Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan, dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh path
, dalam , yang ditentukan mode
, dengan file access
yang ditentukan , menggunakan mode berbagi file yang ditentukan oleh 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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
- access
- FileAccess
Kombinasi bitwise dari FileAccess nilai.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
Contoh
Contoh kode berikut menunjukkan penggunaan konstruktor ini. Untuk konteks lengkap contoh ini, lihat IsolatedStorageFileStream gambaran umum.
// 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)
Keterangan
Penyimpanan terisolasi yang digunakan dicakup oleh identitas assembly yang dijalankan saat ini dan domain aplikasi tempatnya berjalan. Penyimpanan ini akan tetap terbuka hanya selama masa IsolatedStorageFileStream pakai objek. Untuk menentukan cakupan penyimpanan terisolasi yang berbeda, atau untuk memungkinkan penyimpanan tetap terbuka (sehingga beberapa IsolatedStorageFileStream objek dapat dibuka darinya), gunakan bentuk konstruktor yang menerima IsolatedStorageFile objek.
Perhatian
Ketika Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans IsolatedStorageFileStream baru kelas yang memberikan akses ke file yang ditunjuk oleh path
dalam file yang ditentukan mode
, dengan file access
yang ditentukan , dan dalam konteks IsolatedStorageFile yang ditentukan oleh 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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
- access
- FileAccess
Kombinasi bitwise dari FileAccess nilai.
untuk IsolatedStorageFile membuka IsolatedStorageFileStream.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Toko yang terisolasi ditutup.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
isf
tidak memiliki kuota.
Contoh
Contoh kode berikut menunjukkan penggunaan konstruktor ini. Untuk konteks lengkap contoh ini, lihat IsolatedStorageFileStream gambaran umum.
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
Keterangan
Parameter mode
menunjukkan apakah file baru harus dibuat atau yang sudah ada yang digunakan. Parameter ini access
mencakup baca-saja, baca/tulis, dan tulis-saja.
Perhatian
Ketika Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan, dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans baru kelas IsolatedStorageFileStream yang memberikan akses ke file yang ditunjuk oleh path
, dalam file yang ditentukan mode
, dengan file access
yang ditentukan , menggunakan mode berbagi file yang ditentukan oleh share
, dengan buffersize
yang ditentukan.
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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
- access
- FileAccess
Kombinasi bitwise dari FileAccess nilai.
- bufferSize
- Int32
Ukuran FileStream buffer.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
Keterangan
Penyimpanan terisolasi yang digunakan dicakup oleh identitas assembly yang mengeksekusi saat ini dan domain aplikasi tempatnya berjalan. Penyimpanan ini akan tetap terbuka hanya selama masa pakai IsolatedStorageFileStream objek. Untuk menentukan cakupan penyimpanan terisolasi yang berbeda, atau untuk memungkinkan penyimpanan tetap terbuka (sehingga beberapa IsolatedStorageFileStream objek dapat dibuka darinya), gunakan bentuk konstruktor yang menerima IsolatedStorageFile objek.
Parameter mode
menunjukkan apakah file baru harus dibuat atau yang sudah ada yang digunakan. Parameter ini access
mencakup baca-saja, baca/tulis, dan tulis-saja.
Perhatian
Saat Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan, dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans baru kelas IsolatedStorageFileStream yang memberikan akses ke file yang ditunjuk oleh path
, dalam file yang ditentukan mode
, dengan file access
yang ditentukan , menggunakan mode berbagi file yang ditentukan oleh share
, dan dalam konteks IsolatedStorageFile yang ditentukan oleh isf
.
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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
- access
- FileAccess
Kombinasi bitwise dari FileAccess nilai.
untuk IsolatedStorageFile membuka IsolatedStorageFileStream.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
isf
tidak memiliki kuota.
Contoh
Contoh kode berikut menunjukkan penggunaan konstruktor ini. Untuk konteks lengkap contoh ini, lihat IsolatedStorageFileStream gambaran umum.
// 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)
Keterangan
Parameter mode
menunjukkan apakah file baru harus dibuat atau yang sudah ada yang digunakan. Parameter ini access
mencakup baca-saja, baca/tulis, dan tulis-saja.
Perhatian
Saat Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan, dan dapat menyebabkan pengecualian dilemparkan.
Berlaku untuk
IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, Int32, IsolatedStorageFile)
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
- Sumber:
- IsolatedStorageFileStream.cs
Menginisialisasi instans baru kelas IsolatedStorageFileStream yang memberikan akses ke file yang ditunjuk oleh path
, dalam file yang ditentukan mode
, dengan file access
yang ditentukan , menggunakan mode berbagi file yang ditentukan oleh share
, dengan buffersize
yang ditentukan, dan dalam konteks IsolatedStorageFile yang ditentukan oleh isf
.
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)
Parameter
- path
- String
Jalur relatif file dalam penyimpanan terisolasi.
- access
- FileAccess
Kombinasi bitwise dari FileAccess nilai.
- bufferSize
- Int32
Ukuran FileStream buffer.
untuk IsolatedStorageFile membuka IsolatedStorageFileStream.
Pengecualian
Terbentuk path
dengan buruk.
path
adalah null
.
Tidak ada file yang ditemukan dan mode
diatur ke Open.
isf
tidak memiliki kuota.
Contoh
Contoh kode berikut menunjukkan penggunaan konstruktor ini. Untuk konteks lengkap contoh ini, lihat IsolatedStorageFileStream gambaran umum.
// 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)
Keterangan
Parameter mode
menunjukkan apakah file baru harus dibuat atau yang sudah ada yang digunakan. Parameter ini access
mencakup baca-saja, baca/tulis, dan tulis-saja.
Perhatian
Saat Anda mengkompilasi sekumpulan karakter dengan pengaturan budaya tertentu dan mengambil karakter yang sama dengan pengaturan budaya yang berbeda, karakter mungkin tidak dapat ditafsirkan, dan dapat menyebabkan pengecualian dilemparkan.