C# StringWriter WriteLine(Object)

Description

StringWriter WriteLine(Object) Writes the text representation of an object by calling the ToString method on that object, followed by a line terminator to the text string or stream.

Syntax

StringWriter.WriteLine(Object) has the following syntax.


public virtual void WriteLine(
  Object value
)

Parameters

StringWriter.WriteLine(Object) has the following parameters.

  • value - The object to write. If value is null, only the line terminator is written.

Returns

StringWriter.WriteLine(Object) method returns

Example


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

class StrWriter
{
    static void Main()
    {
        StringWriter strWriter = new StringWriter();
        
        strWriter.WriteLine(123L);
        
        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