C# StreamWriter Write(String)

Description

StreamWriter Write(String) Writes a string to the stream.

Syntax

StreamWriter.Write(String) has the following syntax.


public override void Write(
  string value
)

Parameters

StreamWriter.Write(String) has the following parameters.

  • value - The string to write to the stream. If value is null, nothing is written.

Returns

StreamWriter.Write(String) method returns

Example


using System;/*w  w  w .  j  a v  a2s  .  co  m*/
using System.IO;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string fileName = "test.txt";

        using (StreamWriter writer = new StreamWriter(fileName))
        {
            writer.Write("java2s.com");
        }
    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter