StringWriter Constructor (IFormatProvider^)
.NET Framework (current version)
Initializes a new instance of the StringWriter class with the specified format control.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- formatProvider
-
Type:
System::IFormatProvider^
An IFormatProvider object that controls formatting.
A new StringBuilder object is automatically created and associated with the new instance of the StringWriter class.
The following table lists examples of other typical or related I/O tasks.
To do this... | See the example in this topic... |
|---|---|
Create a text file. | |
Write to a text file. | |
Read from a text file. | |
Append text to a file. | |
Get the size of a file. | |
Get the attributes of a file. | |
Set the attributes of a file. | |
Determine if a file exists. | |
Read from a binary file. | |
Write to a binary file. |
The following code example demonstrates how to construct a string in a specific culture.
using namespace System; using namespace System::Globalization; using namespace System::IO; int main() { StringWriter^ strWriter = gcnew StringWriter( gcnew CultureInfo( "ar-DZ" ) ); strWriter->Write( DateTime::Now ); Console::WriteLine( "Current date and time using the invariant culture: {0}\n" "Current date and time using the Algerian culture: {1}", DateTime::Now.ToString(), strWriter->ToString() ); }
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: