IsolatedStorageFileStream 建構函式

定義

初始化 IsolatedStorageFileStream 類別的新執行個體。 開啟 IsolatedStorageFileStream 的唯一方法是使用它的一個建構函式進行。

多載

IsolatedStorageFileStream(String, FileMode)

初始化 IsolatedStorageFileStream 物件的新執行個體,這個執行個體可以存取在指定的 modepath 所指定的檔案。

IsolatedStorageFileStream(String, FileMode, FileAccess)

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可使用所要求的 access 類型,以指定的 mode 存取 path 所指定的檔案。

IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在 isf 所指定之 IsolatedStorageFile 的內容中,用指定的 mode,存取 path 所指定的檔案。

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以使用 path 所指定的檔案共用模式,以指定的檔案 mode 和指定的 access,存取以 share 指定的檔案。

IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)

isf 所指定的 IsolatedStorageFile 之內容中初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以用指定的 mode,使用指定的檔案 access 存取以 path 所指定的檔案。

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

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在指定的 mode 下,存取以 path 所指定的檔案,方式則是使用指定的檔案 access、使用 share 所指定的檔案共用模式,以及指定的 buffersize

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

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在 isf 所指定之 IsolatedStorageFile 的內容中,用指定的 mode,存取以 path 所指定的檔案,方式則是使用指定的檔案 access,以及使用 share 所指定的檔案共用模式。

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

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在 path 所指定之 mode 的內容中,用指定的 access,存取以 share 所指定的檔案,方式則是使用指定的檔案 buffersize、使用 IsolatedStorageFile 所指定的檔案共用模式,以及使用指定的 isf

IsolatedStorageFileStream(String, FileMode)

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 物件的新執行個體,這個執行個體可以存取在指定的 modepath 所指定的檔案。

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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

例外狀況

path 格式不正確。

pathnull

path 中的目錄不存在。

找不到任何檔案,且 mode 設為 Open

備註

所使用的隔離存放區是由目前執行元件的身分識別及其執行所在之應用程式域的身分識別所限定。 此存放區只會在物件的存留期內 IsolatedStorageFileStream 保持開啟狀態。 若要指定不同的隔離儲存範圍,或允許存放區保持開啟 (以便從中開啟多個 IsolatedStorageFileStream 物件) ,請使用接受 IsolatedStorageFile 物件的建構函式形式。

參數 mode 會指出是否應該建立新的檔案、使用的現有檔案等等。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

IsolatedStorageFileStream(String, FileMode, FileAccess)

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可使用所要求的 access 類型,以指定的 mode 存取 path 所指定的檔案。

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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

access
FileAccess

FileAccess 值的位元組合。

例外狀況

path 格式不正確。

pathnull

找不到任何檔案,且 mode 設為 Open

備註

所使用的隔離存放區是由目前執行元件的身分識別及其執行所在之應用程式域的身分識別所限定。 此存放區只會在物件的存留期內 IsolatedStorageFileStream 保持開啟狀態。 若要指定不同的隔離儲存範圍,或允許存放區保持開啟 (以便從中開啟多個 IsolatedStorageFileStream 物件) ,請使用接受 IsolatedStorageFile 物件的建構函式形式。

參數 mode 會指出應該建立新檔案,還是使用現有的檔案。 參數 access 包含唯讀、讀取/寫入和唯讀。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile)

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在 isf 所指定之 IsolatedStorageFile 的內容中,用指定的 mode,存取 path 所指定的檔案。

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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

例外狀況

path 格式不正確。

pathnull

找不到任何檔案,且 mode 設為 Open

isf 沒有配額。

範例

下列程式代碼範例示範如何使用這個建構函式。 如需此範例的完整內容,請參閱概 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)

備註

參數 mode 會指出是否應該建立新的檔案、使用的現有檔案等等。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare)

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以使用 path 所指定的檔案共用模式,以指定的檔案 mode 和指定的 access,存取以 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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

access
FileAccess

FileAccess 值的位元組合。

share
FileShare

FileShare 值的位元組合。

例外狀況

path 格式不正確。

pathnull

找不到任何檔案,且 mode 設為 Open

範例

下列程式代碼範例示範如何使用這個建構函式。 如需此範例的完整內容,請參閱概 IsolatedStorageFileStream 觀。

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

備註

所使用的隔離存放區是由目前執行元件的身分識別及其執行所在之應用程式域的身分識別所限定。 此存放區只會在物件的存留期內 IsolatedStorageFileStream 保持開啟狀態。 若要指定不同的隔離儲存範圍,或允許存放區保持開啟 (以便從中開啟多個 IsolatedStorageFileStream 物件) ,請使用接受 IsolatedStorageFile 物件的建構函式形式。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile)

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

isf 所指定的 IsolatedStorageFile 之內容中初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以用指定的 mode,使用指定的檔案 access 存取以 path 所指定的檔案。

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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

access
FileAccess

FileAccess 值的位元組合。

例外狀況

path 格式不正確。

pathnull

隔離儲存區已關閉。

找不到任何檔案,且 mode 設為 Open

isf 沒有配額。

範例

下列程式代碼範例示範如何使用這個建構函式。 如需此範例的完整內容,請參閱概 IsolatedStorageFileStream 觀。

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

備註

參數 mode 會指出應該建立新檔案,還是使用現有的檔案。 參數 access 包含唯讀、讀取/寫入和唯讀。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

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

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在指定的 mode 下,存取以 path 所指定的檔案,方式則是使用指定的檔案 access、使用 share 所指定的檔案共用模式,以及指定的 buffersize

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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

access
FileAccess

FileAccess 值的位元組合。

share
FileShare

FileShare 值的位元組合。

bufferSize
Int32

FileStream 緩衝區大小。

例外狀況

path 格式不正確。

pathnull

找不到任何檔案,且 mode 設為 Open

備註

所使用的隔離存放區是由目前執行元件的身分識別及其執行所在之應用程式域的身分識別所限定。 此存放區只會在物件的存留期內 IsolatedStorageFileStream 保持開啟狀態。 若要指定不同的隔離儲存範圍,或允許存放區保持開啟 (以便從中開啟多個 IsolatedStorageFileStream 物件) ,請使用接受 IsolatedStorageFile 物件的建構函式形式。

參數 mode 會指出應該建立新檔案,還是使用現有的檔案。 參數 access 包含唯讀、讀取/寫入和唯讀。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

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

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在 isf 所指定之 IsolatedStorageFile 的內容中,用指定的 mode,存取以 path 所指定的檔案,方式則是使用指定的檔案 access,以及使用 share 所指定的檔案共用模式。

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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

access
FileAccess

FileAccess 值的位元組合。

share
FileShare

FileShare 值的位元組合。

例外狀況

path 格式不正確。

pathnull

找不到任何檔案,且 mode 設為 Open

isf 沒有配額。

範例

下列程式代碼範例示範如何使用這個建構函式。 如需此範例的完整內容,請參閱概 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)

備註

參數 mode 會指出應該建立新檔案,還是使用現有的檔案。 參數 access 包含唯讀、讀取/寫入和唯讀。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於

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

來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs
來源:
IsolatedStorageFileStream.cs

初始化 IsolatedStorageFileStream 類別的新執行個體,這個執行個體可以在 path 所指定之 mode 的內容中,用指定的 access,存取以 share 所指定的檔案,方式則是使用指定的檔案 buffersize、使用 IsolatedStorageFile 所指定的檔案共用模式,以及使用指定的 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)

參數

path
String

隔離儲存區中的檔案的相對路徑。

mode
FileMode

其中一個 FileMode 值。

access
FileAccess

FileAccess 值的位元組合。

share
FileShare

FileShare 值的位元組合。

bufferSize
Int32

FileStream 緩衝區大小。

例外狀況

path 格式不正確。

pathnull

找不到任何檔案,且 mode 設為 Open

isf 沒有配額。

範例

下列程式代碼範例示範如何使用這個建構函式。 如需此範例的完整內容,請參閱概 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)

備註

參數 mode 會指出應該建立新檔案,還是使用現有的檔案。 參數 access 包含唯讀、讀取/寫入和唯讀。

警告

當您使用特定文化設定編譯一組字元,並使用不同的文化設定擷取這些相同的字元時,字元可能無法解譯,而且可能會導致擲回例外狀況。

適用於