C# StringWriter Write(Char[], Int32, Int32)

Description

StringWriter Write(Char[], Int32, Int32) Writes a subarray of characters to the string.

Syntax

StringWriter.Write(Char[], Int32, Int32) has the following syntax.


public override void Write(
  char[] buffer,//  w  w w  . j av  a 2 s  .  c om
  int index,
  int count
)

Parameters

StringWriter.Write(Char[], Int32, Int32) has the following parameters.

  • buffer - The character array to write data from.
  • index - The position in the buffer at which to start reading data.
  • count - The maximum number of characters to write.

Returns

StringWriter.Write(Char[], Int32, Int32) method returns

Example


using System;/*  w  ww .ja  va2 s. c  o  m*/
using System.Globalization;
using System.IO;

class StrWriter
{
    static void Main()
    {
        StringWriter strWriter = new StringWriter();

        strWriter.Write(new char[]{'a','v','c','d'},0,2);
        
        Console.WriteLine(strWriter.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter