TextWriter.FormatProvider 属性
定义
获取控制格式设置的对象。Gets an object that controls formatting.
public:
virtual property IFormatProvider ^ FormatProvider { IFormatProvider ^ get(); };
public virtual IFormatProvider FormatProvider { get; }
member this.FormatProvider : IFormatProvider
Public Overridable ReadOnly Property FormatProvider As IFormatProvider
属性值
特定区域性的 IFormatProvider 对象,或者如果未指定任何其他区域性,则为当前区域性的格式设置。An IFormatProvider object for a specific culture, or the formatting of the current culture if no other culture is specified.
注解
属性的值 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 为 null 。If 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. 当 FormatProvider 属性包含时 null ,当前线程的区域性用于格式设置。When the FormatProvider property contains null, the culture of the current thread is used for formatting.
有关创建文件和将文本写入文件的示例,请参阅 如何:将文本写入文件。For an example of creating a file and writing text to a file, see How to: Write Text to a File. 有关从文件读取文本的示例,请参阅 如何:从文件读取文本。For an example of reading text from a file, see How to: Read Text from a File. 有关从二进制文件读取和写入二进制文件的示例,请参阅 如何:读取和写入到新创建的数据文件。For an example of reading from and writing to a binary file, see How to: Read and Write to a Newly Created Data File.
有关常见 i/o 任务的列表,请参阅 常见 I/o 任务。For a list of common I/O tasks, see Common I/O Tasks.