IDynamicValues 介面
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
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 屬性清單中所有要在上下文中顯示的項目。 |