C# StringWriter WriteLine(String, Object)

Description

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

Syntax

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


public virtual void WriteLine(
  string format,
  Object arg0
)

Parameters

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

  • format - A composite format string (see Remarks).
  • arg0 - The object to format and write.

Returns

StringWriter.WriteLine(String, Object) method returns

Example


using System;//from w ww.  j av a  2s  .c o  m
using System.Globalization;
using System.IO;

class StrWriter
{
    static void Main()
    {
        StringWriter strWriter = new StringWriter();
        
        strWriter.WriteLine("{0} is from java2s.com",32L);
        
        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