System.Globalization.CultureInfo.GetFormat Method

Gets an object that defines how to format the specified type.

Syntax

public virtual object GetFormat (Type formatType)

Parameters

formatType
The Type for which to get a formatting object. This method only supports the System.Globalization.NumberFormatInfo and System.Globalization.DateTimeFormatInfo types.

Returns

The value of the CultureInfo.NumberFormat property, which is a System.Globalization.NumberFormatInfo containing the default number format information for the current System.Globalization.CultureInfo, if formatType is the Type object for the System.Globalization.NumberFormatInfo class.

-or-

The value of the CultureInfo.DateTimeFormat property, which is a System.Globalization.DateTimeFormatInfo containing the default date and time format information for the current System.Globalization.CultureInfo, if formatType is the Type object for the System.Globalization.DateTimeFormatInfo class.

-or-

null, if formatType is any other object.

Remarks

CultureInfo.GetFormat(Type) implements IFormatProvider.GetFormat(Type).

NumberFormatInfo provides the culture-specific numeric format used in conjunction with the Format methods in the base data types. DateTimeFormatInfo controls how the date and time values are formatted for a specific culture.

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0