TextFieldParser Constructors

Definition

Initializes a new instance of the TextFieldParser class.

Overloads

TextFieldParser(Stream)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(TextReader)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(String)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(Stream, Encoding)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(String, Encoding)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(Stream, Encoding, Boolean)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(String, Encoding, Boolean)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(Stream, Encoding, Boolean, Boolean)

Initializes a new instance of the TextFieldParser class.

TextFieldParser(Stream)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::IO::Stream ^ stream);
public TextFieldParser (System.IO.Stream stream);
new Microsoft.VisualBasic.FileIO.TextFieldParser : System.IO.Stream -> Microsoft.VisualBasic.FileIO.TextFieldParser

Parameters

stream
Stream

Stream. The stream to be parsed.

Exceptions

stream is Nothing.

stream cannot be read from.

Remarks

Creates a new TextFieldParser object to parse the file or stream that is represented by the stream parameter.

See also

TextFieldParser(TextReader)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::IO::TextReader ^ reader);
public TextFieldParser (System.IO.TextReader reader);
new Microsoft.VisualBasic.FileIO.TextFieldParser : System.IO.TextReader -> Microsoft.VisualBasic.FileIO.TextFieldParser
Public Sub New (reader As TextReader)

Parameters

reader
TextReader

TextReader. The TextReader stream to be parsed.

Exceptions

reader is Nothing.

Remarks

Creates a new TextFieldParser object to parse the file or stream that is represented by the reader parameter.

See also

TextFieldParser(String)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::String ^ path);
public TextFieldParser (string path);
new Microsoft.VisualBasic.FileIO.TextFieldParser : string -> Microsoft.VisualBasic.FileIO.TextFieldParser
Public Sub New (path As String)

Parameters

path
String

String. The complete path of the file to be parsed.

Exceptions

path is an empty string.

Remarks

Creates a new TextFieldParser object to parse the file specified by the path parameter.

See also

TextFieldParser(Stream, Encoding)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::IO::Stream ^ stream, System::Text::Encoding ^ defaultEncoding);
public TextFieldParser (System.IO.Stream stream, System.Text.Encoding defaultEncoding);
new Microsoft.VisualBasic.FileIO.TextFieldParser : System.IO.Stream * System.Text.Encoding -> Microsoft.VisualBasic.FileIO.TextFieldParser

Parameters

stream
Stream

Stream. The stream to be parsed.

defaultEncoding
Encoding

Encoding. The character encoding to use if encoding is not determined from file. Default is UTF8.

Exceptions

stream or defaultEncoding is Nothing.

stream cannot be read from.

Remarks

Creates a new TextFieldParser object to parse the file or stream that is represented by the stream parameter.

Caution

When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable and could cause an exception to be thrown.

See also

TextFieldParser(String, Encoding)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::String ^ path, System::Text::Encoding ^ defaultEncoding);
public TextFieldParser (string path, System.Text.Encoding defaultEncoding);
new Microsoft.VisualBasic.FileIO.TextFieldParser : string * System.Text.Encoding -> Microsoft.VisualBasic.FileIO.TextFieldParser
Public Sub New (path As String, defaultEncoding As Encoding)

Parameters

path
String

String. The complete path of the file to be parsed.

defaultEncoding
Encoding

Encoding. The character encoding to use if encoding is not determined from file. Default is UTF8.

Exceptions

path is an empty string or defaultEncoding is Nothing.

Remarks

Creates a new TextFieldParser object to parse the file specified by the path parameter.

Caution

When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable and could cause an exception to be thrown.

See also

TextFieldParser(Stream, Encoding, Boolean)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::IO::Stream ^ stream, System::Text::Encoding ^ defaultEncoding, bool detectEncoding);
public TextFieldParser (System.IO.Stream stream, System.Text.Encoding defaultEncoding, bool detectEncoding);
new Microsoft.VisualBasic.FileIO.TextFieldParser : System.IO.Stream * System.Text.Encoding * bool -> Microsoft.VisualBasic.FileIO.TextFieldParser

Parameters

stream
Stream

Stream. The stream to be parsed.

defaultEncoding
Encoding

Encoding. The character encoding to use if encoding is not determined from file. Default is UTF8.

detectEncoding
Boolean

Boolean. Indicates whether to look for byte order marks at the beginning of the file. Default is True.

Exceptions

stream or defaultEncoding is Nothing.

stream cannot be read from.

Remarks

Creates a new TextFieldParser object to parse the file or stream that is represented by the stream parameter.

If the detectEncoding parameter is True, this constructor attempts to detect the encoding by looking at the first three bytes of the file or stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte-order marks. Otherwise, the encoding specified by defaultEncoding is used.

Caution

When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable and could cause an exception to be thrown.

See also

TextFieldParser(String, Encoding, Boolean)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::String ^ path, System::Text::Encoding ^ defaultEncoding, bool detectEncoding);
public TextFieldParser (string path, System.Text.Encoding defaultEncoding, bool detectEncoding);
new Microsoft.VisualBasic.FileIO.TextFieldParser : string * System.Text.Encoding * bool -> Microsoft.VisualBasic.FileIO.TextFieldParser
Public Sub New (path As String, defaultEncoding As Encoding, detectEncoding As Boolean)

Parameters

path
String

String. The complete path of the file to be parsed.

defaultEncoding
Encoding

Encoding. The character encoding to use if encoding is not determined from file. Default is UTF8.

detectEncoding
Boolean

Boolean. Indicates whether to look for byte order marks at the beginning of the file. Default is True.

Exceptions

path is an empty string or defaultEncoding is Nothing.

Remarks

Creates a new TextFieldParser object to parse the file specified by the path parameter.

If the detectEncoding parameter is True, this constructor attempts to detect the encoding by looking at the first three bytes of the file or stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte-order marks. Otherwise, the encoding specified by defaultEncoding is used.

Caution

When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable and could cause an exception to be thrown.

See also

TextFieldParser(Stream, Encoding, Boolean, Boolean)

Initializes a new instance of the TextFieldParser class.

public:
 TextFieldParser(System::IO::Stream ^ stream, System::Text::Encoding ^ defaultEncoding, bool detectEncoding, bool leaveOpen);
public TextFieldParser (System.IO.Stream stream, System.Text.Encoding defaultEncoding, bool detectEncoding, bool leaveOpen);
new Microsoft.VisualBasic.FileIO.TextFieldParser : System.IO.Stream * System.Text.Encoding * bool * bool -> Microsoft.VisualBasic.FileIO.TextFieldParser

Parameters

stream
Stream

Stream. The stream to be parsed.

defaultEncoding
Encoding

Encoding. The character encoding to use if encoding is not determined from file. Default is UTF8.

detectEncoding
Boolean

Boolean. Indicates whether to look for byte order marks at the beginning of the file. Default is True.

leaveOpen
Boolean

Boolean. Indicates whether to leave stream open when the TextFieldParser object is closed. Default is False.

Exceptions

stream or defaultEncoding is Nothing.

stream cannot be read from.

Remarks

Creates a new TextFieldParser object to parse the file or stream that is represented by the stream parameter.

If the detectEncoding parameter is True, this constructor attempts to detect the encoding by looking at the first three bytes of the file or stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte-order marks. Otherwise, the encoding specified by defaultEncoding is used.

Caution

When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable and could cause an exception to be thrown.

See also

Applies to