TypeConverter.GetStandardValues 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回資料型別的標準值集合,這個型別轉換子 (Type Converter) 是針對這個資料型別而設計。
GetStandardValues() |
從為這個型別轉換子所設計的資料型別預設內容中,會傳回標準值的集合。 |
GetStandardValues(ITypeDescriptorContext) |
提供格式內容時,傳回此類型轉換子所針對資料類型的標準值集合。 |
從為這個型別轉換子所設計的資料型別預設內容中,會傳回標準值的集合。
public:
System::Collections::ICollection ^ GetStandardValues();
C#
public System.Collections.ICollection GetStandardValues ();
C#
public System.Collections.ICollection? GetStandardValues ();
member this.GetStandardValues : unit -> System.Collections.ICollection
Public Function GetStandardValues () As ICollection
傳回
TypeConverter.StandardValuesCollection 含有標準有效值的集合,如果資料型別不支援標準值集合,則為 null
。
備註
在這個類別中實作時,這個方法永遠傳回 null
。
適用於
.NET 9 及其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
提供格式內容時,傳回此類型轉換子所針對資料類型的標準值集合。
public:
virtual System::ComponentModel::TypeConverter::StandardValuesCollection ^ GetStandardValues(System::ComponentModel::ITypeDescriptorContext ^ context);
C#
public virtual System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues (System.ComponentModel.ITypeDescriptorContext context);
C#
public virtual System.ComponentModel.TypeConverter.StandardValuesCollection? GetStandardValues (System.ComponentModel.ITypeDescriptorContext? context);
abstract member GetStandardValues : System.ComponentModel.ITypeDescriptorContext -> System.ComponentModel.TypeConverter.StandardValuesCollection
override this.GetStandardValues : System.ComponentModel.ITypeDescriptorContext -> System.ComponentModel.TypeConverter.StandardValuesCollection
Public Overridable Function GetStandardValues (context As ITypeDescriptorContext) As TypeConverter.StandardValuesCollection
參數
- context
- ITypeDescriptorContext
提供格式內容的 ITypeDescriptorContext,可用來擷取環境的其他資訊,而這個轉換子就是從此環境叫用。 這個參數或這個參數的屬性可為 null
。
傳回
保留標準有效值集合的 TypeConverter.StandardValuesCollection,或者如果資料類型不支援標準值集合,則為 null
。
範例
如需此函式的範例,請參閱 類別 TypeConverter 。
備註
如同 在 中實作 TypeConverter,這個方法一律會傳 null
回 。
給繼承者的注意事項
如果您想要轉換的類型支持標準值,請覆寫這個方法。
另請參閱
適用於
.NET 9 及其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |