C# StringWriter Write(String, Object, Object, Object)

Description

StringWriter Write(String, Object, Object, Object) Writes a formatted string to the text string or stream, using the same semantics as the String.Format(String, Object, Object, Object) method.

Syntax

StringWriter.Write(String, Object, Object, Object) has the following syntax.


public virtual void Write(
  string format,//from  w  w w. ja  va 2  s.  c om
  Object arg0,
  Object arg1,
  Object arg2
)

Parameters

StringWriter.Write(String, Object, Object, Object) has the following parameters.

  • format - A composite format string (see Remarks).
  • arg0 - The first object to format and write.
  • arg1 - The second object to format and write.
  • arg2 - The third object to format and write.

Returns

StringWriter.Write(String, Object, Object, Object) method returns

Example


using System;/*from  w w w  . j  a  v a2 s  .  c o m*/
using System.Globalization;
using System.IO;

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

        strWriter.Write("{0} is from java2s.com {1}, {2}",123D,234,345);
        
        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