TextWriter 构造函数

定义

初始化 TextWriter 类的新实例。Initializes a new instance of the TextWriter class.

重载

TextWriter()

初始化 TextWriter 类的新实例。Initializes a new instance of the TextWriter class.

TextWriter(IFormatProvider)

使用指定的格式提供程序初始化 TextWriter 类的新实例。Initializes a new instance of the TextWriter class with the specified format provider.

TextWriter()

初始化 TextWriter 类的新实例。Initializes a new instance of the TextWriter class.

protected:
 TextWriter();
protected TextWriter ();
Protected Sub New ()

注解

如果您不希望为FormatProvider属性提供值,请使用此构造函数重载。Use this constructor overload when you do not want to provide a value for the FormatProvider property. 当属性为null时,当前线程的区域性用于格式设置。 FormatProviderWhen the FormatProvider property is null, the culture of the current thread is used for formatting.

将此构造函数用于派生类。Use this constructor for derived classes.

有关常见 i/o 任务的列表, 请参阅常见 I/o 任务For a list of common I/O tasks, see Common I/O Tasks.

另请参阅

TextWriter(IFormatProvider)

使用指定的格式提供程序初始化 TextWriter 类的新实例。Initializes a new instance of the TextWriter class with the specified format provider.

protected:
 TextWriter(IFormatProvider ^ formatProvider);
protected TextWriter (IFormatProvider formatProvider);
new System.IO.TextWriter : IFormatProvider -> System.IO.TextWriter
Protected Sub New (formatProvider As IFormatProvider)

参数

formatProvider
IFormatProvider

控制格式设置的 IFormatProvider 对象。An IFormatProvider object that controls formatting.

注解

使用此构造函数重载提供FormatProvider属性的值。Use this constructor overload to provide a value for the FormatProvider property. FormatProvider属性的值指定Write调用和WriteLine方法时使用的特定于区域性的格式设置。The value of the FormatProvider property specifies the culture-specific formatting that is used when you call the Write and WriteLine methods. 如果你不希望提供格式提供程序,可以使用TextWriter()构造函数创建一个实例,该构造函数FormatProvider将属性设置为nullIf you do not want to provide a format provider, you create an instance by using the TextWriter() constructor, which sets the FormatProvider property to null. 当属性为null时,当前线程的区域性用于格式设置。 FormatProviderWhen the FormatProvider property is null, the culture of the current thread is used for formatting.

有关常见 i/o 任务的列表, 请参阅常见 I/o 任务For a list of common I/O tasks, see Common I/O Tasks.

另请参阅

适用于