文字の部分配列をテキスト ストリームに書き込みます。
Overloads Public Overridable Sub Write( _
ByVal buffer() As Char, _ ByVal index As Integer, _ ByVal count As Integer _)
[C#]
public virtual void Write(char[] buffer,intindex,intcount);
[C++]
public: virtual void Write(__wchar_tbuffer __gc[],intindex,intcount);
[JScript]
public function Write(
buffer : Char[],index : int,count : int);
パラメータ
- buffer
データの書き込み元の文字配列。 - index
バッファ内の開始インデックス。 - count
書き込む文字の数。
例外
例外の種類 | 条件 |
---|---|
ArgumentException | バッファ長から index を差し引いた値が count より小さい値です。 |
ArgumentNullException | buffer パラメータが null 参照 (Visual Basic では Nothing) です。 |
ArgumentOutOfRangeException | index または count が負の値です。 |
ObjectDisposedException | TextWriter が閉じています。 |
IOException | I/O エラーが発生しました。 |
解説
このメソッドは、 index を開始位置として、 buffer 文字配列からこの TextWriter にデータの count 文字を書き込みます。
この形式の Write は、 buffer の index から (index + count) までの間にある各文字について、 Write(Char[]) と等価です。
その他の一般的な I/O タスクまたは関連する I/O タスクの例を次の表に示します。
実行するタスク | 参考例があるトピック |
---|---|
テキスト ファイルを作成する。 | ファイルへのテキストの書き込み |
テキスト ファイルに書き込む。 | ファイルへのテキストの書き込み |
テキスト ファイルから読み取る。 | ファイルからのテキストの読み取り |
テキストをファイルに追加する。 | ログ ファイルのオープンと追加 |
ファイルのサイズを取得する。 | FileInfo.Length |
ファイルの属性を取得する。 | File.GetAttributes |
ファイルの属性を設定する。 | File.SetAttributes |
ファイルが存在するかどうかを判別する。 | File.Exists |
バイナリ ファイルから読み取る。 | 新しく作成したデータ ファイルの読み取りと書き込み |
バイナリ ファイルに書き込む。 | 新しく作成したデータ ファイルの読み取りと書き込み |
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard
参照
TextWriter クラス | TextWriter メンバ | System.IO 名前空間 | TextWriter.Write オーバーロードの一覧 | 入出力操作 | ファイルからのテキストの読み取り | ファイルへのテキストの書き込み