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 Constructor

.NET Framework 1.1

Overload List

Initializes a new instance of the TextWriter class.

Supported by the .NET Compact Framework.

[Visual Basic] Protected Sub New()
[C#] protected TextWriter();
[C++] protected: TextWriter();
[JScript] protected function TextWriter();

Initializes a new instance of the TextWriter class with the specified format provider.

Supported by the .NET Compact Framework.

[Visual Basic] Protected Sub New(IFormatProvider)
[C#] protected TextWriter(IFormatProvider);
[C++] protected: TextWriter(IFormatProvider*);
[JScript] protected function TextWriter(IFormatProvider);

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 the TextWriter constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Dim aStringWriter, aStreamWriter As TextWriter
aStringWriter = New StringWriter()
aStreamWriter = New StreamWriter("InvalidPathChars.txt")

[C#] 
TextWriter stringWriter = new StringWriter();
using(TextWriter streamWriter = 
    new StreamWriter("InvalidPathChars.txt"))

[C++] 
TextWriter* stringWriter = new StringWriter(); 
TextWriter* streamWriter = 
    new StreamWriter("InvalidPathChars.txt");

[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:
© 2015 Microsoft