DateTimeFormatInfo.GetInstance(IFormatProvider) 方法

定義

傳回與指定 DateTimeFormatInfo 關聯的 IFormatProvider 物件。

public:
 static System::Globalization::DateTimeFormatInfo ^ GetInstance(IFormatProvider ^ provider);
public static System.Globalization.DateTimeFormatInfo GetInstance (IFormatProvider provider);
public static System.Globalization.DateTimeFormatInfo GetInstance (IFormatProvider? provider);
static member GetInstance : IFormatProvider -> System.Globalization.DateTimeFormatInfo
Public Shared Function GetInstance (provider As IFormatProvider) As DateTimeFormatInfo

參數

provider
IFormatProvider

IFormatProvider,此提供者會取得 DateTimeFormatInfo 物件。

-或-

若要取得 CurrentInfo,則為 null

傳回

DateTimeFormatInfo 相關聯的 IFormatProvider 物件。

備註

這個方法會使用 方法formatProviderIFormatProvider.GetFormat使用 DateTimeFormatInfo 物件做為 Type 參數。 如果 是 null 或 如果 IFormatProvider.GetFormatformatProvider 傳回 null,這個方法會傳CurrentInfo回 。

您的應用程式可以使用下列其中一種方法取得 DateTimeFormatInfo 特定文化特性的物件:

DateTimeFormatInfo物件只能針對非變異文化特性或特定文化特性建立,而不是針對中性文化特性建立。

如需非變異文化特性、特定文化特性和中性文化特性的詳細資訊,請參閱 CultureInfo 類別描述。

適用於

另請參閱