共用方式為


CultureInfo.GetFormat Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable Function GetFormat ( _
    formatType As Type _
) As Object
public virtual Object GetFormat(
    Type formatType
)

Parameters

Return Value

Type: System.Object
The value of the NumberFormat property, if formatType is a Type object that represents the NumberFormatInfo class. This value is a NumberFormatInfo object that contains numeric formatting information for this CultureInfo object,
-or-
The value of the DateTimeFormat property, if formatType is a Type object that represents the DateTimeFormatInfo class. This value is a DateTimeFormatInfo object that contains date and time formatting information for this CultureInfo object,
-or-
nulla null reference (Nothing in Visual Basic) , if formatType is any other object.

Implements

IFormatProvider.GetFormat(Type)

Remarks

GetFormat implements IFormatProvider.GetFormat. Typically, this method is not called directly from user code. Instead, it is called by parsing and formatting methods such as Int32.Parse(String, IFormatProvider) or DateTime.ToString(String, IFormatProvider).

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.