[This is preliminary documentation and is subject to change.]

Formats the value of the current instance using the specified format.

Namespace:  Tools
Assembly:  Tools (in Tools.dll) Version: 1.5.2.0

Syntax

C#
public string ToString(
	string format,
	IFormatProvider formatProvider
)
Visual Basic (Declaration)
Public Function ToString ( _
	format As String, _
	formatProvider As IFormatProvider _
) As String
Visual C++
public:
virtual String^ ToString(
	String^ format, 
	IFormatProvider^ formatProvider
) sealed
J#
public final String ToString(
	String format,
	IFormatProvider formatProvider
)
JScript
public final function ToString(
	format : String, 
	formatProvider : IFormatProvider
) : String

Parameters

format
Type: System..::.String
The String specifying the format to use.-or- null to use the default format defined for the type of the TimeSpanFormattable.
formatProvider
Type: System..::.IFormatProvider
The IFormatProvider to use to format the value.-or- null to obtain the numeric format information from the current locale setting of the operating system.

If null is pased then CurrentCulture is used. This argument is used to obtain decimal separators, positive and negative signs and time separators in custom format and is also passed to custom subformats in braces. In order this parameter to work it's GetFormat method must return non-null value for NumberFormatInfo and/or DateTimeFormatInfo. If one of returned values is null CurrentInfo resp. CurrentInfo is used.

Return Value

A String containing the value of the current instance in the specified format.

Implements

IFormattable..::.ToString(String, IFormatProvider)

Remarks

For more information about formating of TimeSpanFormattable see documentation of overloaded

Exceptions

ExceptionCondition
System..::.FormatExceptionUnknown predefined format -or- syntax error in format string
System..::.ArgumentOutOfRangeExceptionThe 'T()' patter is used on negative TimeSpanFormattable or value of current TimeSpanFormattable added to MinValue causes MaxValue to be exceeded.

See Also