C# StringWriter Write(Object)

Description

StringWriter Write(Object) Writes the text representation of an object to the text string or stream by calling the ToString method on that object.

Syntax

StringWriter.Write(Object) has the following syntax.


public virtual void Write(
  Object value
)

Parameters

StringWriter.Write(Object) has the following parameters.

  • value - The object to write.

Returns

StringWriter.Write(Object) method returns

Example


using System;//  w w w  . j ava  2  s .  c  o m
using System.Globalization;
using System.IO;

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

        strWriter.Write(123F);
        
        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