Прочетете на английски Редактиране

Споделяне чрез


TextFieldParser.Delimiters Property

Definition

Defines the delimiters for a text file.

C#
public string[]? Delimiters { get; set; }
C#
public string[] Delimiters { get; set; }

Property Value

String[]

A string array that contains all of the field delimiters for the TextFieldParser object.

Exceptions

A delimiter value is set to a newline character, an empty string, or Nothing.

Examples

This example specifies that the delimiter for the TextFieldParser object, FileReader, is a comma (,).

VB
FileReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited
FileReader.Delimiters = New String() {","}

Remarks

This property is meaningful only if the TextFieldType property is set to FieldType.Delimited.

Defining the delimiters for a text file can also be accomplished with the SetDelimiters method.

The following table lists an example of a task involving the Delimiters property.

To See
Read from a delimited text file How to: Read From Comma-Delimited Text Files

Applies to

Продукт Версии
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also