Sideway
output.to from Sideway
Draft for Information Only

Content

Device I/O
 TextReader Class
  Constructors
  Fields
  Methods
  Remarks
  Applies to
  See also
 TextWriter Class
  Constructors
  Fields
  Properties
  Methods
  Remarks
  Applies to
  See also
 Source/Reference

Device I/O

The main components used in .NET framework to access the device i/o are Stream, BufferedStream, FileStream, MemoryStream, StreamReader, StreamWriter, StringReader, StringWriter, TextReader, TextWriter, BinaryReader, and BinaryWriter.

TextReader Class

Represents a reader that can read a sequential series of characters.

NamespaceSystem.IO AssembliesSystem.IO.dll, mscorlib.dll, netstandard.dll, System.Runtime.Extensions.dll
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class TextReader : MarshalByRefObject, IDisposable

Inheritance: Object->->MarshalByRefObject->TextReader

Derived: StreamReader, StringReader

Attributes: ComVisibleAttribute, SerializableAttribute

Implements: IDisposable

Constructors

TextReader()

Initializes a new instance of the TextReader class.

Fields

Null

Provides a TextReader with no data to read from.

Methods

Close()

Closes the TextReader and releases any system resources associated with the TextReader.

CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose()

Releases all resources used by the TextReader object.

Dispose(Boolean)

Releases the unmanaged resources used by the TextReader and optionally releases the managed resources.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
Peek()

Reads the next character without changing the state of the reader or the character source. Returns the next available character without actually reading it from the reader.

Read()

Reads the next character from the text reader and advances the character position by one character.

Read(Char[], Int32, Int32)

Reads a specified maximum number of characters from the current reader and writes the data to a buffer, beginning at the specified index.

ReadAsync(Char[], Int32, Int32)

Reads a specified maximum number of characters from the current text reader asynchronously and writes the data to a buffer, beginning at the specified index.

ReadBlock(Char[], Int32, Int32)

Reads a specified maximum number of characters from the current text reader and writes the data to a buffer, beginning at the specified index.

ReadBlockAsync(Char[], Int32, Int32)

Reads a specified maximum number of characters from the current text reader asynchronously and writes the data to a buffer, beginning at the specified index.

ReadLine()

Reads a line of characters from the text reader and returns the data as a string.

ReadLineAsync()

Reads a line of characters asynchronously and returns the data as a string.

ReadToEnd()

Reads all characters from the current position to the end of the text reader and returns them as one string.

ReadToEndAsync()

Reads all characters from the current position to the end of the text reader asynchronously and returns them as one string.

Synchronized(TextReader)

Creates a thread-safe wrapper around the specified TextReader.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Remarks

  • TextReader is the abstract base class of StreamReader and StringReader, which read characters from streams and strings, respectively. Use these derived classes to open a text file for reading a specified range of characters, or to create a reader based on an existing stream.

    Important

    This type implements the IDisposable interface. When you have finished using any type that derives from this type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see Dispose and the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

    Notes to Inheritors

    A derived class must minimally implement the Peek() and Read() methods to make a useful instance of TextReader.

Applies to

.NET Framework: 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, 4.0, 3.5, 3.0, 2.0, 1.1

See also

TextWriter Class

Represents a writer that can write a sequential series of characters. This class is abstract.

NamespaceSystem.IO AssembliesSystem.IO.dll, mscorlib.dll, netstandard.dll, System.Runtime.Extensions.dll
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class TextWriter : MarshalByRefObject, IDisposable

Inheritance: Object->MarshalByRefObject->TextWriter

Derived: IndentedTextWriter, StreamWriter, StringWriter, HttpWriter, HtmlTextWriter

Attributes

Implements: IDisposable

Constructors

TextWriter()

Initializes a new instance of the TextWriter class.

TextWriter(IFormatProvider)

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

Fields

CoreNewLine

Stores the newline characters used for this TextWriter.

Null

Provides a TextWriter with no backing store that can be written to, but not read from.

Properties

Encoding

When overridden in a derived class, returns the character encoding in which the output is written.

FormatProvider

Gets an object that controls formatting.

NewLine

Gets or sets the line terminator string used by the current TextWriter.

Methods

Close()

Closes the current writer and releases any system resources associated with the writer.

CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose()

Releases all resources used by the TextWriter object.

Dispose(Boolean)

Releases the unmanaged resources used by the TextWriter and optionally releases the managed resources.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Flush()

Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

FlushAsync()

Asynchronously clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
Synchronized(TextWriter)

Creates a thread-safe wrapper around the specified TextWriter.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
Write(Boolean)

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

Write(Char)

Writes a character to the text stream.

Write(Char[])

Writes a character array to the text stream.

Write(Char[], Int32, Int32)

Writes a subarray of characters to the text stream.

Write(Decimal)

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

Write(Double)

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

Write(Int32)

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

Write(Int64)

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

Write(Object)

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

Write(Single)

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

Write(String)

Writes a string to the text stream.

Write(String, Object)

Writes a formatted string to the text stream, using the same semantics as the Format(String, Object) method.

Write(String, Object, Object)

Writes a formatted string to the text stream using the same semantics as the Format(String, Object, Object) method.

Write(String, Object, Object, Object)

Writes a formatted string to the text stream, using the same semantics as the Format(String, Object, Object, Object) method.

Write(String, Object[])

Writes a formatted string to the text stream, using the same semantics as the Format(String, Object[]) method.

Write(UInt32)

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

Write(UInt64)

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

WriteAsync(Char)

Writes a character to the text stream asynchronously.

WriteAsync(Char[])

Writes a character array to the text stream asynchronously.

WriteAsync(Char[], Int32, Int32)

Writes a subarray of characters to the text stream asynchronously.

WriteAsync(String)

Writes a string to the text stream asynchronously.

WriteLine()

Writes a line terminator to the text stream.

WriteLine(Boolean)

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

WriteLine(Char)

Writes a character to the text stream, followed by a line terminator.

WriteLine(Char[])

Writes an array of characters to the text stream, followed by a line terminator.

WriteLine(Char[], Int32, Int32)

Writes a subarray of characters to the text stream, followed by a line terminator.

WriteLine(Decimal)

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

WriteLine(Double)

Writes the text representation of a 8-byte floating-point value to the text stream, followed by a line terminator.

WriteLine(Int32)

Writes the text representation of a 4-byte signed integer to the text stream, followed by a line terminator.

WriteLine(Int64)

Writes the text representation of an 8-byte signed integer to the text stream, followed by a line terminator.

WriteLine(Object)

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

WriteLine(Single)

Writes the text representation of a 4-byte floating-point value to the text stream, followed by a line terminator.

WriteLine(String)

Writes a string to the text stream, followed by a line terminator.

WriteLine(String, Object)

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

WriteLine(String, Object, Object)

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

WriteLine(String, Object, Object, Object)

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

WriteLine(String, Object[])

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

WriteLine(UInt32)

Writes the text representation of a 4-byte unsigned integer to the text stream, followed by a line terminator.

WriteLine(UInt64)

Writes the text representation of an 8-byte unsigned integer to the text stream, followed by a line terminator.

WriteLineAsync()

Asynchronously writes a line terminator to the text stream.

WriteLineAsync(Char)

Asynchronously writes a character to the text stream, followed by a line terminator.

WriteLineAsync(Char[])

Asynchronously writes an array of characters to the text stream, followed by a line terminator.

WriteLineAsync(Char[], Int32, Int32)

Asynchronously writes a subarray of characters to the text stream, followed by a line terminator.

WriteLineAsync(String)

Asynchronously writes a string to the text stream, followed by a line terminator.

Remarks

  • TextWriter is the abstract base class of StreamWriter and StringWriter, which write characters to streams and strings, respectively. Create an instance of TextWriter to write an object to a string, write strings to a file, or to serialize XML. You can also use an instance of TextWriter to write text to a custom backing store using the same APIs you would use for a string or a stream, or to add support for text formatting.

    All the Write methods of TextWriter having primitive data types as parameters write out the values as strings.

    By default, a TextWriter is not thread safe. See TextWriter.Synchronized for a thread-safe wrapper.

    Important

    This type implements the IDisposable interface. When you have finished using any type that derives from this type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see Dispose and the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

    For a list of common I/O tasks, see Common I/O Tasks.

    Notes to Inheritors

    A derived class must minimally implement the Write(Char) method to make a useful instance of TextWriter.

Applies to

.NET Framework: 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, 4.0, 3.5, 3.0, 2.0, 1.1

See also

Source/Reference


©sideway

ID: 200700014 Last Updated: 7/14/2020 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019