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

特定文化特性的 IFormatProvider 物件,或者目前文化特性的格式 (如果未指定其他文化特性)。An IFormatProvider object for a specific culture, or the formatting of the current culture if no other culture is specified.

備註

屬性的值 FormatProvider 會指定當您呼叫和方法時,所使用的特定文化特性 Write 格式 WriteLineThe 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. 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.

適用於

另請參閱