Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TextWriter.WriteLine Method (Object)

.NET Framework 1.1

Writes the text representation of an object by calling ToString on this object, followed by a line terminator to the text stream.

[Visual Basic]
Overloads Public Overridable Sub WriteLine( _
   ByVal value As Object _
)
[C#]
public virtual void WriteLine(
 object value
);
[C++]
public: virtual void WriteLine(
 Object* value
);
[JScript]
public function WriteLine(
   value : Object
);

Parameters

value
The object to write. If value is a null reference (Nothing in Visual Basic), only the line termination characters are written.

Exceptions

Exception Type Condition
ObjectDisposedException The TextWriter is closed.
IOException An I/O error occurs.

Remarks

This version of WriteLine is equivalent to Write(String.ToString()).

The following table lists examples of other typical or related I/O tasks.

To do this... See the example in this topic...
Create a text file. Writing Text to a File
Write to a text file. Writing Text to a File
Read from a text file. Reading Text from a File
Append text to a file. Opening and Appending to a Log File

File.AppendText

FileInfo.AppendText

Get the size of a file. FileInfo.Length
Get the attributes of a file. File.GetAttributes
Set the attributes of a file. File.SetAttributes
Determine if a file exists. File.Exists
Read from a binary file. Reading and Writing to a Newly Created Data File
Write to a binary file. Reading and Writing to a Newly Created Data File

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

TextWriter Class | TextWriter Members | System.IO Namespace | TextWriter.WriteLine Overload List | Working with I/O | Reading Text from a File | Writing Text to a File

Show:
© 2015 Microsoft