IDynamicValues 介面

定義

IDynamicValues 介面用於建立字串屬性的動態清單。 類別應實作此介面,並使用 DynamicValuesAttribute(下方)來產生動態值。

當一串字串直到執行時才會被知道時,可以在下拉選單中顯示時使用。 很好的例子有資料庫名稱、使用者、彙整等。

public interface IDynamicValues
type IDynamicValues = interface
Public Interface IDynamicValues

範例

public TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { string[] collationName = new string[] { “first item”, “second itme” }; return new TypeConverter.StandardValuesCollection(collationName); }

方法

名稱 Description
GetStandardValues(ITypeDescriptorContext)

GetStandardValue 應該回傳一個 StandardValuesCollection,該集合包含 specifiec 屬性清單中所有要在上下文中顯示的項目。

適用於