DateTimeFormatInfo.GetFormat(Type) 方法

定義

傳回指定類型的物件,以提供日期和時間格式服務。Returns an object of the specified type that provides a date and time formatting service.

public:
 virtual System::Object ^ GetFormat(Type ^ formatType);
public object GetFormat (Type formatType);
abstract member GetFormat : Type -> obj
override this.GetFormat : Type -> obj
Public Function GetFormat (formatType As Type) As Object

參數

formatType
Type

需要的格式服務的類型。The type of the required formatting service.

傳回

如果 formatType 與目前 DateTimeFormatInfo 的類型相同,則為目前的物件,否則為 nullThe current object, if formatType is the same as the type of the current DateTimeFormatInfo; otherwise, null.

實作

備註

當目前的 DateTimeFormatInfo 物件當做 IFormatProvider 參數傳遞時,基底資料類型所支援的 Format(String, IFormatProvider) 方法會叫用這個方法。The Format(String, IFormatProvider) method supported by the base data types invoke this method when the current DateTimeFormatInfo object is passed as the IFormatProvider parameter. 這個方法會實作 IFormatProvider.GetFormatThis method implements IFormatProvider.GetFormat.

適用於

另請參閱