Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TextWriter.Write Method

Writes the given data type to a text stream.

Overload List

Writes the text representation of a Boolean value to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Boolean)
[C#] public virtual void Write(bool);
[C++] public: virtual void Write(bool);
[JScript] public function Write(Boolean);

Writes a character to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Char)
[C#] public virtual void Write(char);
[C++] public: virtual void Write(__wchar_t);
[JScript] public function Write(Char);

Writes a character array to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Char())
[C#] public virtual void Write(char[]);
[C++] public: virtual void Write(__wchar_t __gc[]);
[JScript] public function Write(Char[]);

Writes the text representation of a decimal value followed by a line terminator to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Decimal)
[C#] public virtual void Write(decimal);
[C++] public: virtual void Write(Decimal);
[JScript] public function Write(Decimal);

Writes the text representation of an 8-byte floating-point value to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Double)
[C#] public virtual void Write(double);
[C++] public: virtual void Write(double);
[JScript] public function Write(double);

Writes the text representation of a 4-byte signed integer to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Integer)
[C#] public virtual void Write(int);
[C++] public: virtual void Write(int);
[JScript] public function Write(int);

Writes the text representation of an 8-byte signed integer to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Long)
[C#] public virtual void Write(long);
[C++] public: virtual void Write(__int64);
[JScript] public function Write(long);

Writes the text representation of an object to the text stream by calling ToString on that object.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Object)
[C#] public virtual void Write(object);
[C++] public: virtual void Write(Object*);
[JScript] public function Write(Object);

Writes the text representation of a 4-byte floating-point value to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Single)
[C#] public virtual void Write(float);
[C++] public: virtual void Write(float);
[JScript] public function Write(float);

Writes a string to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(String)
[C#] public virtual void Write(string);
[C++] public: virtual void Write(String*);
[JScript] public function Write(String);

Writes the text representation of a 4-byte unsigned integer to the text stream. This method is not CLS-compliant.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(UInt32)
[C#] public virtual void Write(uint);
[C++] public: virtual void Write(unsigned int);
[JScript] public function Write(UInt32);

Writes the text representation of an 8-byte unsigned integer to the text stream. This method is not CLS-compliant.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(UInt64)
[C#] public virtual void Write(ulong);
[C++] public: virtual void Write(unsigned __int64);
[JScript] public function Write(UInt64);

Writes out a formatted string, using the same semantics as String.Format.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(String, Object)
[C#] public virtual void Write(string, object);
[C++] public: virtual void Write(String*, Object*);
[JScript] public function Write(String, Object);

Writes out a formatted string, using the same semantics as String.Format.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(String, ParamArray Object())
[C#] public virtual void Write(string, params object[]);
[C++] public: virtual void Write(String*, Object[]);
[JScript] public function Write(String, Object[]);

Writes a subarray of characters to the text stream.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(Char(), Integer, Integer)
[C#] public virtual void Write(char[], int, int);
[C++] public: virtual void Write(__wchar_t __gc[], int, int);
[JScript] public function Write(Char[], int, int);

Writes out a formatted string, using the same semantics as String.Format.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Sub Write(String, Object, Object)
[C#] public virtual void Write(string, object, object);
[C++] public: virtual void Write(String*, Object*, Object*);
[JScript] public function Write(String, Object, Object);

Writes out a formatted string, using the same semantics as String.Format.

[Visual Basic] Overloads Public Overridable Sub Write(String, Object, Object, Object)
[C#] public virtual void Write(string, object, object, object);
[C++] public: virtual void Write(String*, Object*, Object*, Object*);
[JScript] public function Write(String, Object, Object, Object);

Example

[Visual Basic, C#, C++] This code example is part of a larger example provided for the TextWriter class.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Write. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Shared Sub WriteText(aTextWriter As TextWriter)
    aTextWriter.Write("Invalid file path characters are: ")
    aTextWriter.Write(Path.InvalidPathChars)
    aTextWriter.Write("."C)
End Sub

[C#] 
static void WriteText(TextWriter textWriter)
{
    textWriter.Write("Invalid file path characters are: ");
    textWriter.Write(Path.InvalidPathChars);
    textWriter.Write('.');
}

[C++] 
static void WriteText(TextWriter* textWriter)
{
    textWriter->Write("Invalid file path characters are: ");
    textWriter->Write(Path::InvalidPathChars);
    textWriter->Write(Char::Parse(S"."));
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

TextWriter Class | TextWriter Members | System.IO Namespace

Show:
© 2017 Microsoft