This documentation is archived and is not being maintained.

CultureInfo.GetFormat Method

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

[Visual Basic]
Public Overridable Function GetFormat( _
   ByVal formatType As Type _
) As Object Implements IFormatProvider.GetFormat
public virtual object GetFormat(
 Type formatType
public: virtual Object* GetFormat(
 Type* formatType
public function GetFormat(
   formatType : Type
) : Object;


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

Return Value

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


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


A null reference (Nothing in Visual Basic), if formatType is any other object.




GetFormat implements IFormatProvider.GetFormat.

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.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

CultureInfo Class | CultureInfo Members | System.Globalization Namespace | Type | NumberFormatInfo | DateTimeFormatInfo | NumberFormat | DateTimeFormat